Add: Webでの引用表示 (#50)

* Add compacted component

* 引用表示の間にコンテナをはさみ、不要なコードを削除

* 引用APIを作成、ついでにブロック状況を引用APIに反映

* テスト修正など

* 引用をキャッシュに登録

* `quote_id`が`quote_of_id`になったのをSerializerに反映

* Fix test

* 引用をフィルターの対象に含める設定+エラー修正

* ストリーミングの存在しないプロパティ削除によるエラーを修正

* Fix lint

* 他のサーバーから来た引用付き投稿を処理

* Fix test

* フィルター設定時エラーの調整

* 画像つき投稿のスタイルを調整

* 画像つき投稿の最大高さを調整

* 引用禁止・非表示の設定を追加

* ブロック対応

* マイグレーションコード調整

* 引用設定の翻訳を作成

* Lint修正

* 参照1つの場合は引用に変換する設定を削除

* 不要になったテストを削除

* ブロック設定追加、バグ修正

* 他サーバーへ引用送信・受け入れ
This commit is contained in:
KMY(雪あすか) 2023-10-02 11:12:51 +09:00 committed by GitHub
parent 3c649aa74d
commit 44b739a39a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 1362 additions and 120 deletions

View file

@ -444,7 +444,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
def related_to_local_activity?
fetch? || followed_by_local_accounts? || requested_through_relay? ||
responds_to_followed_account? || addresses_local_accounts?
responds_to_followed_account? || addresses_local_accounts? || quote_local?
end
def responds_to_followed_account?
@ -485,10 +485,22 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
def process_references!
references = @object['references'].nil? ? [] : ActivityPub::FetchReferencesService.new.call(@status, @object['references'])
quote = @object['quote'] || @object['quoteUrl'] || @object['quoteURL'] || @object['_misskey_quote']
references << quote if quote
ProcessReferencesService.perform_worker_async(@status, [], references)
ProcessReferencesService.perform_worker_async(@status, [], references, [quote].compact)
end
def quote_local?
url = quote
if url.present?
ResolveURLService.new.call(url, on_behalf_of: @account, local_only: true).present?
else
false
end
end
def quote
@quote ||= @object['quote'] || @object['quoteUrl'] || @object['quoteURL'] || @object['_misskey_quote']
end
def join_group!

View file

@ -54,6 +54,7 @@ class StatusReachFinder
reblogs_account_ids,
favourites_account_ids,
replies_account_ids,
quoted_account_id,
].tap do |arr|
arr.flatten!
arr.compact!
@ -88,6 +89,10 @@ class StatusReachFinder
@status.replies.pluck(:account_id) if distributable? || unsafe?
end
def quoted_account_id
@status.quote.account_id if @status.quote?
end
def followers_inboxes
if @status.in_reply_to_local_account? && distributable?
@status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account)).where.not(domain: banned_domains).inboxes