Change: #185 『スタンプをつけられた人』ではなく『スタンプをつけた人』のフォロワーにスタンプを転送 (#232)

* Change: #185 『スタンプをつけられた人』ではなく『スタンプをつけた人』のフォロワーにスタンプを転送

* Fix: 絵文字削除が届かない問題

* Test: 送る方にも同じテストを追加
This commit is contained in:
KMY(雪あすか) 2023-11-04 21:27:59 +09:00 committed by GitHub
parent a1d197dfef
commit 24909f9760
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 134 additions and 91 deletions

View file

@ -161,11 +161,46 @@ RSpec.describe EmojiReactService, type: :service do
end
end
context 'when has remote followers' do
context 'when remote status' do
let(:author) { Fabricate(:account, domain: 'author.foo.bar', uri: 'https://author.foo.bar/actor', inbox_url: 'https://author.foo.bar/inbox', protocol: 'activitypub') }
before do
stub_request(:post, 'https://author.foo.bar/inbox')
end
it 'react with emoji' do
expect(subject.count).to eq 1
expect(a_request(:post, 'https://author.foo.bar/inbox').with(body: hash_including({
type: 'Like',
actor: ActivityPub::TagManager.instance.uri_for(sender),
content: '😀',
}))).to have_been_made.once
end
context 'when has followers' do
let!(:bob) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar/actor', inbox_url: 'https://foo.bar/inbox', protocol: 'activitypub') }
before do
bob.follow!(sender)
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
expect(subject.count).to eq 1
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Like',
actor: ActivityPub::TagManager.instance.uri_for(sender),
content: '😀',
}))).to have_been_made.once
end
end
end
context 'when sender has remote followers' do
let!(:bob) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar/actor', inbox_url: 'https://foo.bar/inbox', protocol: 'activitypub') }
before do
bob.follow!(author)
bob.follow!(sender)
stub_request(:post, 'https://foo.bar/inbox')
end