Deliver to each recipient only once

closes #7071
This commit is contained in:
Benjamin Neff 2016-09-07 04:22:51 +02:00 committed by Dennis Schubert
parent 3f2586bc6f
commit fe071aa2a2
No known key found for this signature in database
GPG key ID: 5A0304BEA7966D7E
3 changed files with 21 additions and 1 deletions

View file

@ -23,6 +23,7 @@
* Fix moving publisher on first click after page load [#7094](https://github.com/diaspora/diaspora/pull/7094)
* Fix link to comment on report page [#7105](https://github.com/diaspora/diaspora/pull/7105)
* Fix duplicate flash message on mobile profile edit [#7107](https://github.com/diaspora/diaspora/pull/7107)
* Clicking photos on mobile should no longer cause 404s [#7071](https://github.com/diaspora/diaspora/pull/7071)
## Features
* Deleted comments will be removed when loading more comments [#7045](https://github.com/diaspora/diaspora/pull/7045)

View file

@ -36,7 +36,7 @@ module Diaspora
end
def deliver_to_subscribers
local_people, remote_people = subscribers.partition(&:local?)
local_people, remote_people = subscribers.uniq(&:id).partition(&:local?)
deliver_to_local(local_people) unless local_people.empty?
deliver_to_remote(remote_people)

View file

@ -10,6 +10,25 @@ describe Diaspora::Federation::Dispatcher::Private do
end
describe "#dispatch" do
context "deliver to local user" do
it "delivers to each user only once" do
aspect1 = alice.aspects.first
aspect2 = alice.aspects.create(name: "cat people")
alice.add_contact_to_aspect(alice.contact_for(bob.person), aspect2)
post = FactoryGirl.create(
:status_message,
author: alice.person,
text: "hello",
public: false,
aspects: [aspect1, aspect2]
)
expect(Workers::ReceiveLocal).to receive(:perform_async).with("StatusMessage", post.id, [bob.id])
Diaspora::Federation::Dispatcher.build(alice, post).dispatch
end
end
context "deliver to remote user" do
let(:xml) { "<diaspora/>" }
it "queues a private send job" do