Commit 08c6d485 authored by Jonne Haß's avatar Jonne Haß Committed by GitHub

Merge pull request #7005 from SuperTux88/fix-reshare-delete

don't add the root author to the subscribers if the root post was deleted
parents 33c8e029 c6427c4e
......@@ -70,7 +70,7 @@ class Reshare < Post
end
def subscribers
super + [root.author]
super.tap {|people| root.try {|root| people << root.author } }
end
private
......
......@@ -135,5 +135,16 @@ describe Reshare, type: :model do
expect(reshare.subscribers).to match_array([alice.person, eve.person, user.person])
end
it "does not add the root author if the root post was deleted" do
user = FactoryGirl.create(:user_with_aspect)
user.share_with(alice.person, user.aspects.first)
post = eve.post(:status_message, text: "hello", public: true)
reshare = FactoryGirl.create(:reshare, root: post, author: user.person)
post.destroy
expect(reshare.reload.subscribers).to match_array([alice.person, user.person])
end
end
end
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