Skip to content
Extraits de code Groupes Projets
Valider cf5a7271 rédigé par Benjamin Neff's avatar Benjamin Neff
Parcourir les fichiers

participates root author when receiving a reshare

parent 9fa3cc97
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -63,6 +63,12 @@ class Reshare < Post
@absolute_root
end
def receive(recipient_user_ids)
super(recipient_user_ids)
root.author.owner.participate!(self) if root.author.local?
end
def subscribers
super + [root.author]
end
......
......@@ -34,6 +34,11 @@ describe "Receive federation messages feature" do
post = FactoryGirl.create(:status_message, author: alice.person, public: true)
reshare = FactoryGirl.build(
:reshare_entity, root_author: alice.diaspora_handle, root_guid: post.guid, author: sender_id)
expect(Participation::Generator).to receive(:new).with(
alice, instance_of(Reshare)
).and_return(double(create!: true))
post_message(generate_xml(reshare, sender))
expect(Reshare.exists?(root_guid: post.guid)).to be_truthy
......
......@@ -33,6 +33,15 @@ describe Reshare, type: :model do
end
end
describe "#receive" do
let(:reshare) { create(:reshare, root: FactoryGirl.build(:status_message, author: bob.person, public: true)) }
it "participates root author in the reshare" do
reshare.receive([])
expect(Participation.count(target_id: reshare.id, author_id: bob.person.id)).to eq(1)
end
end
describe "#nsfw" do
let(:sfw) { build(:status_message, author: alice.person, public: true) }
let(:nsfw) { build(:status_message, author: alice.person, public: true, text: "This is #nsfw") }
......
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