only include mutual sharing contacts in conversations form on contacts page
fixes #7377
This commit is contained in:
parent
c7709e29f2
commit
40fc175d6e
3 changed files with 7 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ app.pages.Contacts = Backbone.View.extend({
|
||||||
showMessageModal: function(){
|
showMessageModal: function(){
|
||||||
$("#conversationModal").on("modal:loaded", function() {
|
$("#conversationModal").on("modal:loaded", function() {
|
||||||
var people = _.pluck(app.contacts.filter(function(contact) {
|
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");
|
}), "person");
|
||||||
new app.views.ConversationsForm({prefill: people});
|
new app.views.ConversationsForm({prefill: people});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ describe ContactsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates the aspects_manage_contacts_json fixture", fixture: true do
|
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
|
get :index, params: {a_id: @aspect.id, page: "1"}, format: :json
|
||||||
save_fixture(response.body, "aspects_manage_contacts_json")
|
save_fixture(response.body, "aspects_manage_contacts_json")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,9 @@ describe("app.pages.Contacts", function(){
|
||||||
expect(app.views.ConversationsForm.prototype.initialize).toHaveBeenCalled();
|
expect(app.views.ConversationsForm.prototype.initialize).toHaveBeenCalled();
|
||||||
|
|
||||||
var prefill = app.views.ConversationsForm.prototype.initialize.calls.mostRecent().args[0].prefill;
|
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; }));
|
expect(_.pluck(prefill, "id")).toEqual(contacts.map(function(contact) { return contact.person.id; }));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue