Skip to content
Extraits de code Groupes Projets
Valider 08c6d485 rédigé par Jonne Haß's avatar Jonne Haß Validation de GitHub
Parcourir les fichiers

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
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -70,7 +70,7 @@ class Reshare < Post ...@@ -70,7 +70,7 @@ class Reshare < Post
end end
def subscribers def subscribers
super + [root.author] super.tap {|people| root.try {|root| people << root.author } }
end end
private private
......
...@@ -135,5 +135,16 @@ describe Reshare, type: :model do ...@@ -135,5 +135,16 @@ describe Reshare, type: :model do
expect(reshare.subscribers).to match_array([alice.person, eve.person, user.person]) expect(reshare.subscribers).to match_array([alice.person, eve.person, user.person])
end 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
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter