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

@ -47,6 +47,9 @@
.fields-group
= f.input :reject_new_follow, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_new_follow'), hint: I18n.t('admin.domain_blocks.reject_new_follow_hint')
.fields-group
= f.input :reject_friend, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_friend'), hint: I18n.t('admin.domain_blocks.reject_friend_hint')
.fields-group
= f.input :detect_invalid_subscription, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.detect_invalid_subscription'), hint: I18n.t('admin.domain_blocks.detect_invalid_subscription_hint')

View file

@ -47,6 +47,9 @@
.fields-group
= f.input :reject_new_follow, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_new_follow'), hint: I18n.t('admin.domain_blocks.reject_new_follow_hint')
.fields-group
= f.input :reject_friend, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_friend'), hint: I18n.t('admin.domain_blocks.reject_friend_hint')
.fields-group
= f.input :detect_invalid_subscription, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.detect_invalid_subscription'), hint: I18n.t('admin.domain_blocks.detect_invalid_subscription_hint')

View file

@ -0,0 +1,41 @@
%tr
%td
- unless friend.available
%span.negative-hint
= fa_icon('times')
= ' '
= t 'admin.friend_servers.disabled'
%samp= friend.domain
%td
- if friend.i_am_accepted?
%span.positive-hint
= fa_icon('check')
= ' '
= t 'admin.friend_servers.enabled'
- elsif friend.i_am_pending?
= fa_icon('hourglass')
= ' '
= t 'admin.friend_servers.pending'
- else
%span.negative-hint
= fa_icon('times')
= ' '
= t 'admin.friend_servers.disabled'
%td
- if friend.they_are_accepted?
%span.positive-hint
= fa_icon('check')
= ' '
= t 'admin.friend_servers.enabled'
- elsif friend.they_are_pending?
= fa_icon('hourglass')
= ' '
= t 'admin.friend_servers.pending'
- else
%span.negative-hint
= fa_icon('times')
= ' '
= t 'admin.friend_servers.disabled'
%td
= table_link_to 'pencil', t('admin.friend_servers.edit_friend'), edit_admin_friend_server_path(friend)
= table_link_to 'times', t('admin.friend_servers.delete'), admin_friend_server_path(friend), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') }

View file

@ -0,0 +1,20 @@
%p= t 'admin.friend_servers.edit.description'
%hr.spacer/
.fields-group
= f.input :domain, as: :string, wrapper: :with_label, required: true, disabled: !friend.id.nil?, label: t('admin.friend_servers.edit.domain')
.fields-group
= f.input :inbox_url, as: :string, wrapper: :with_label, label: t('admin.friend_servers.edit.inbox_url'), hint: t('admin.friend_servers.edit.inbox_url_hint')
.fields-group
= f.input :available, as: :boolean, wrapper: :with_label, label: t('admin.friend_servers.edit.available')
.fields-group
= f.input :pseudo_relay, as: :boolean, wrapper: :with_label, label: t('admin.friend_servers.edit.pseudo_relay')
.fields-group
= f.input :unlocked, as: :boolean, wrapper: :with_label, label: t('admin.friend_servers.edit.unlocked')
.fields-group
= f.input :allow_all_posts, as: :boolean, wrapper: :with_label, label: t('admin.friend_servers.edit.allow_all_posts')

View file

@ -0,0 +1,52 @@
- content_for :page_title do
= t('admin.friend_servers.edit_friend')
= simple_form_for @friend, url: admin_friend_server_path(@friend), method: :put do |f|
= render 'shared/error_messages', object: @friend
= render 'friend_fields', f: f, friend: @friend
.fields-group
%h4= t('admin.friend_servers.active_status')
.fields-group
- if @friend.i_am_accepted?
%span.positive-hint
= fa_icon('check')
= ' '
= t 'admin.friend_servers.enabled'
- elsif @friend.i_am_pending?
= fa_icon('hourglass')
= ' '
= t 'admin.friend_servers.pending'
- else
%span.negative-hint
= fa_icon('times')
= ' '
= t 'admin.friend_servers.disabled'
.action-buttons
%div
= link_to t('admin.friend_servers.follow'), follow_admin_friend_server_path(@friend), class: 'button', method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if @friend.i_am_idle? || @friend.i_am_rejected?
= link_to t('admin.friend_servers.unfollow'), unfollow_admin_friend_server_path(@friend), class: 'button', method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if @friend.i_am_pending? || @friend.i_am_accepted?
%h4= t('admin.friend_servers.passive_status')
.fields-gtoup
- if @friend.they_are_accepted?
%span.positive-hint
= fa_icon('check')
= ' '
= t 'admin.friend_servers.enabled'
- elsif @friend.they_are_pending?
= fa_icon('hourglass')
= ' '
= t 'admin.friend_servers.pending'
- else
%span.negative-hint
= fa_icon('times')
= ' '
= t 'admin.friend_servers.disabled'
.action-buttons
%div
= link_to t('admin.friend_servers.accept'), accept_admin_friend_server_path(@friend), class: 'button', method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if @friend.they_are_pending?
= link_to t('admin.friend_servers.reject'), reject_admin_friend_server_path(@friend), class: 'button', method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if @friend.they_are_pending?
.actions
= f.button :button, t('generic.save_changes'), type: :submit

View file

@ -0,0 +1,21 @@
- content_for :page_title do
= t('admin.friend_servers.title')
.simple_form
%p.hint= t('admin.friend_servers.description_html')
= link_to @friends.empty? ? t('admin.friend_servers.setup') : t('admin.friend_servers.add_new'), new_admin_friend_server_path, class: 'block-button'
- unless @friends.empty?
%hr.spacer
.table-wrapper
%table.table
%thead
%tr
%th= t('admin.friend_servers.domain')
%th= t('admin.friend_servers.active_status')
%th= t('admin.friend_servers.passive_status')
%th
%tbody
- @friends.each do |friend|
= render 'friend_domain', friend: friend

View file

@ -0,0 +1,9 @@
- content_for :page_title do
= t('admin.friend_servers.add_new')
= simple_form_for @friend, url: admin_friend_servers_path do |f|
= render 'shared/error_messages', object: @friend
= render 'friend_fields', f: f, friend: @friend
.actions
= f.button :button, t('admin.friend_servers.save_and_enable'), type: :submit

View file

@ -45,6 +45,11 @@
.fields-group
= f.input :enable_public_unlisted_visibility, as: :boolean, wrapper: :with_label, kmyblue: true, hint: false
%h4= t('admin.settings.discovery.friend_servers')
.fields-group
= f.input :unlocked_friend, as: :boolean, wrapper: :with_label, kmyblue: true, hint: false
%h4= t('admin.settings.discovery.publish_statistics')
.fields-group