Add: フレンドサーバー (#61)

* Fix mastodon version

* テーブル作成

* Wip: フレンドサーバーフォローの承認を受信

* Wip: フレンド申請拒否を受信

* Wip: フォローリクエストを受理

* Wip: 相手からのフォロー・アンフォローを受理

* 普通のフォローとフレンドサーバーのフォローを区別するテストを追加

* ドメインブロックによるフォロー拒否

* ドメインブロックしたあと、申請中のフォロリクを取り下げる処理

* スタブに条件を追加

* Wip: 相手からのDelete信号に対応

* DB定義が消えていたので修正

* Wip: ローカル公開投稿をフレンドに送信する処理など

* Wip: 未収載+誰でもの投稿をフレンドに送る設定

* Wip: ローカル公開をそのまま送信する設定を考慮

* Fix test

* Wip: 他サーバーからのローカル公開投稿の受け入れ

* Wip: Web画面作成

* Fix test

* Wip: ローカル公開を連合TLに流す

* Wip: フレンドサーバーの削除ボタン

* Wip: メール通知や設定のテストなど

* Wip: 翻訳を作成

* Fix: 却下されたあとフォローボタンが表示されない問題

* Wip: 編集できない問題

* 有効にしていないフレンドサーバーをリストで無効表示
This commit is contained in:
KMY(雪あすか) 2023-10-09 11:51:15 +09:00 committed by GitHub
parent acb29e5b11
commit 87e858a202
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 1638 additions and 51 deletions

View file

@ -28,6 +28,7 @@
# hidden_anonymous :boolean default(FALSE), not null
# detect_invalid_subscription :boolean default(FALSE), not null
# reject_reply_exclude_followers :boolean default(FALSE), not null
# reject_friend :boolean default(FALSE), not null
#
class DomainBlock < ApplicationRecord
@ -44,7 +45,16 @@ class DomainBlock < ApplicationRecord
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
scope :with_user_facing_limitations, -> { where(hidden: false) }
scope :with_limitations, -> { where(severity: [:silence, :suspend]).or(where(reject_media: true)).or(where(reject_favourite: true)).or(where(reject_reply: true)).or(where(reject_reply_exclude_followers: true)).or(where(reject_new_follow: true)).or(where(reject_straight_follow: true)) }
scope :with_limitations, lambda {
where(severity: [:silence, :suspend])
.or(where(reject_media: true))
.or(where(reject_favourite: true))
.or(where(reject_reply: true))
.or(where(reject_reply_exclude_followers: true))
.or(where(reject_new_follow: true))
.or(where(reject_straight_follow: true))
.or(where(reject_friend: true))
}
scope :by_severity, -> { order(Arel.sql('(CASE severity WHEN 0 THEN 1 WHEN 1 THEN 2 WHEN 2 THEN 0 END), domain')) }
def to_log_human_identifier
@ -68,6 +78,7 @@ class DomainBlock < ApplicationRecord
reject_hashtag? ? :reject_hashtag : nil,
reject_straight_follow? ? :reject_straight_follow : nil,
reject_new_follow? ? :reject_new_follow : nil,
reject_friend? ? :reject_friend : nil,
detect_invalid_subscription? ? :detect_invalid_subscription : nil,
reject_reports? ? :reject_reports : nil].reject { |policy| policy == :noop || policy.nil? }
end
@ -110,6 +121,10 @@ class DomainBlock < ApplicationRecord
!!rule_for(domain)&.reject_new_follow?
end
def reject_friend?(domain)
!!rule_for(domain)&.reject_friend?
end
def detect_invalid_subscription?(domain)
!!rule_for(domain)&.detect_invalid_subscription?
end