From 9a35a0d8dd27f142095ff02fd698f83f9f16668f Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Sat, 21 Nov 2015 21:45:19 +0200 Subject: [PATCH] Add participation to root.author on receiving reshare When author of the root post receives a reshare to it, no participation is added to the root author on the reshare. This causes any comments on the reshare on remote pods not to be sent to the author. Adding a participation should subscribe to the reshare and thus bring added comments back to the author. closes #6481 --- Changelog.md | 1 + app/models/reshare.rb | 1 + spec/models/reshare_spec.rb | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 9be9daa03..fb7e4d72e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ * Fix notifications for interactions by non-contacts [#6498](https://github.com/diaspora/diaspora/pull/6498) * Fix issue where the publisher was broken on profile pages [#6503](https://github.com/diaspora/diaspora/pull/6503) * Prevent participations being created for invalid interactions [#6552](https://github.com/diaspora/diaspora/pull/6552) +* Improve federation for reshare related interactions [#6481](https://github.com/diaspora/diaspora/pull/6481) ## Features diff --git a/app/models/reshare.rb b/app/models/reshare.rb index 93803af1d..1781595e9 100644 --- a/app/models/reshare.rb +++ b/app/models/reshare.rb @@ -56,6 +56,7 @@ class Reshare < Post def receive(recipient, sender) local_reshare = Reshare.where(:guid => self.guid).first if local_reshare && local_reshare.root.author_id == recipient.person.id + recipient.participate! self return unless recipient.has_contact_for?(sender) end super(recipient, sender) diff --git a/spec/models/reshare_spec.rb b/spec/models/reshare_spec.rb index e235c4066..6a5f2cd45 100644 --- a/spec/models/reshare_spec.rb +++ b/spec/models/reshare_spec.rb @@ -50,7 +50,8 @@ describe Reshare, :type => :model do receive_reshare expect(@root.resharers).to include(@reshare.author) end - it 'does not error if the root author has a contact for the resharer' do + + it "does not error if the root author has a contact for the resharer" do bob.share_with @reshare.author, bob.aspects.first expect { Timeout.timeout(5) do @@ -58,6 +59,12 @@ describe Reshare, :type => :model do end }.not_to raise_error end + + it "participates root author in the reshare" do + receive_reshare + participations = Participation.where(target_id: @reshare.id, author_id: @root.author_id) + expect(participations.count).to eq(1) + end end describe '#nsfw' do