Add: #8 サークル投稿の転送 (#294)

* Add: `conversations`テーブルに`ancestor_status`プロパティ

* Fix test

* Fix test more

* Add: `limited_visibility`に`Reply`を追加、`context`のURI

* Add: 外部からの`context`受信処理

* Fix test

* Add: 公開範囲「返信」

* Fix test

* Fix: 返信に返信以外の公開範囲を設定できない問題

* Add: ローカル投稿時にメンション追加・他サーバーへの転送

* Fix test

* Fix test

* Test: ローカルスレッドへの返信投稿の転送

* Test: 未知のアカウントからのメンション

* Add: 編集・削除の連合に対応

* Remove: 重複テスト

* Fix: 改善

* Add: 編集削除の転送処理・返信なのにsilentなメンションでの通知

* Fix: リプライが第三者に届かない問題

* Add: `always_sign_unsafe`

* Add: Subject

* Remove space

* Fix: 他人のスレッドの送信先一覧を非表示

* Fix: おかしいコード
This commit is contained in:
KMY(雪あすか) 2023-11-30 09:29:24 +09:00 committed by GitHub
parent a52a8ce214
commit a88349af55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 1115 additions and 77 deletions

View file

@ -683,6 +683,84 @@ RSpec.describe FanOutOnWriteService, type: :service do
end
end
context 'when status has a conversation' do
let(:conversation) { Fabricate(:conversation) }
let(:status) { Fabricate(:status, account: alice, visibility: visibility, thread: parent_status, conversation: conversation) }
let(:parent_status) { Fabricate(:status, account: bob, visibility: visibility, conversation: conversation) }
let(:zilu) { Fabricate(:user, current_sign_in_at: last_active_at).account }
let(:custom_before) { true }
before do
zilu.follow!(alice)
zilu.follow!(bob)
Fabricate(:status, account: tom, visibility: visibility, conversation: conversation)
Fabricate(:status, account: ohagi, visibility: visibility, conversation: conversation)
status.mentions << Fabricate(:mention, account: bob, silent: true)
status.mentions << Fabricate(:mention, account: ohagi, silent: true)
status.mentions << Fabricate(:mention, account: zilu, silent: true)
status.mentions << Fabricate(:mention, account: tom, silent: false)
status.save
subject.call(status)
end
context 'when public visibility' do
it 'does not create notification' do
notification = Notification.find_by(account: bob, type: 'mention')
expect(notification).to be_nil
end
it 'creates notification for active mention' do
notification = Notification.find_by(account: tom, type: 'mention')
expect(notification).to_not be_nil
expect(notification.mention.status_id).to eq status.id
end
it 'inserts home feed for reply' do
expect(home_feed_of(bob)).to include status.id
end
it 'inserts home feed for non-replied but mentioned and following replied account' do
expect(home_feed_of(zilu)).to include status.id
end
it 'does not insert home feed for non-replied, non-following replied account but mentioned' do
expect(home_feed_of(tom)).to_not include status.id
end
end
context 'when limited visibility' do
let(:visibility) { :limited }
it 'creates notification' do
notification = Notification.find_by(account: bob, type: 'mention')
expect(notification).to_not be_nil
expect(notification.mention.status_id).to eq status.id
end
it 'creates notification for other conversation account' do
notification = Notification.find_by(account: ohagi, type: 'mention')
expect(notification).to_not be_nil
expect(notification.mention.status_id).to eq status.id
end
it 'inserts home feed for reply' do
expect(home_feed_of(bob)).to include status.id
end
it 'inserts home feed for non-replied but mentioned and following replied account' do
expect(home_feed_of(zilu)).to include status.id
end
it 'does not insert home feed for non-replied, non-following replied account but mentioned' do
expect(home_feed_of(tom)).to_not include status.id
end
end
end
context 'when updated status is already boosted or quoted' do
let(:custom_before) { true }