スタンプ機能のリファクタリング、投稿の反応者へも配送 (#140)

This commit is contained in:
KMY(雪あすか) 2023-10-18 10:23:17 +09:00 committed by GitHub
parent 9b1821d001
commit d62a135806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 87 additions and 47 deletions

View file

@ -138,4 +138,54 @@ RSpec.describe EmojiReactService, type: :service do
expect(subject.first.custom_emoji.domain).to eq 'foo.bar'
end
end
context 'when 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)
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
context 'when has relay server' do
before do
Fabricate(:relay, inbox_url: 'https://foo.bar/inbox', state: :accepted)
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
context 'when has friend server' do
before do
Fabricate(:friend_domain, inbox_url: 'https://foo.bar/inbox', active_state: :accepted, pseudo_relay: true)
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