Merge branch 'next-minor' into develop

This commit is contained in:
Benjamin Neff 2018-03-22 23:17:15 +01:00
commit 38d92cc84b
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
5 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View file

@ -50,6 +50,7 @@ public/source.tar*
tmp/ tmp/
# Temporary files of every sort # Temporary files of every sort
.byebug_history
.sass-cache/ .sass-cache/
.DS_Store .DS_Store
.idea .idea

View file

@ -13,6 +13,7 @@
## Refactor ## Refactor
## Bug fixes ## Bug fixes
* Prefill conversation form on contacts page only with mutual contacts [#7744](https://github.com/diaspora/diaspora/pull/7744)
## Features ## Features

View file

@ -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});
}); });

View file

@ -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

View file

@ -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; }));
}); });
}); });