Commit 40fc175d authored by kas70's avatar kas70 Committed by Benjamin Neff

only include mutual sharing contacts in conversations form on contacts page

fixes #7377
parent c7709e29
......@@ -81,7 +81,7 @@ app.pages.Contacts = Backbone.View.extend({
showMessageModal: function(){
$("#conversationModal").on("modal:loaded", function() {
var people = _.pluck(app.contacts.filter(function(contact) {
return contact.inAspect(app.aspect.get("id"));
return contact.person.get("relationship") === "mutual" && contact.inAspect(app.aspect.get("id"));
}), "person");
new app.views.ConversationsForm({prefill: people});
});
......
......@@ -20,6 +20,9 @@ describe ContactsController, :type => :controller do
end
it "generates the aspects_manage_contacts_json fixture", fixture: true do
# adds one not mutual contact
bob.share_with(FactoryGirl.create(:person), @aspect)
get :index, params: {a_id: @aspect.id, page: "1"}, format: :json
save_fixture(response.body, "aspects_manage_contacts_json")
end
......
......@@ -297,7 +297,9 @@ describe("app.pages.Contacts", function(){
expect(app.views.ConversationsForm.prototype.initialize).toHaveBeenCalled();
var prefill = app.views.ConversationsForm.prototype.initialize.calls.mostRecent().args[0].prefill;
var contacts = app.contacts.filter(function(contact) { return contact.inAspect(app.aspect.get("id")); });
var contacts = app.contacts.filter(function(contact) {
return contact.person.get("relationship") === "mutual" && contact.inAspect(app.aspect.get("id"));
});
expect(_.pluck(prefill, "id")).toEqual(contacts.map(function(contact) { return contact.person.id; }));
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment