Commit fe071aa2 authored by Benjamin Neff's avatar Benjamin Neff Committed by Dennis Schubert

Deliver to each recipient only once

closes #7071
parent 3f2586bc
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
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