participates root author when receiving a reshare
This commit is contained in:
parent
9fa3cc97d4
commit
cf5a72719e
3 changed files with 20 additions and 0 deletions
|
|
@ -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") }
|
||||
|
|
|
|||
Loading…
Reference in a new issue