From 53c2aa797b21754509363fc5d89122a743bf0b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Wed, 6 Mar 2024 12:30:48 +0900 Subject: [PATCH] =?UTF-8?q?Add:=20#36=20=E3=82=A2=E3=82=AB=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=83=88=E8=A9=B3=E7=B4=B0=E7=94=BB=E9=9D=A2=E3=81=AE?= =?UTF-8?q?=E3=80=8C=E3=83=95=E3=82=A9=E3=83=AD=E3=83=BC=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=BE=E3=81=99=E3=80=8D=E3=82=92=E9=9A=A0?= =?UTF-8?q?=E3=81=99=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3=20(#638)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add: #36 アカウント詳細画面の「フォローされています」を隠すオプション * Fix lint --- .../mastodon/features/account/components/header.jsx | 6 +++--- app/javascript/mastodon/features/followers/index.jsx | 6 +++++- app/javascript/mastodon/features/following/index.jsx | 8 +++++--- app/javascript/mastodon/initial_state.js | 1 + app/models/concerns/user/has_settings.rb | 4 ++++ app/models/user_settings.rb | 1 + app/serializers/initial_state_serializer.rb | 1 + app/views/settings/preferences/appearance/show.html.haml | 1 + config/locales/simple_form.en.yml | 1 + config/locales/simple_form.ja.yml | 1 + 10 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/javascript/mastodon/features/account/components/header.jsx b/app/javascript/mastodon/features/account/components/header.jsx index 1a451f0320de90..d627eba482b826 100644 --- a/app/javascript/mastodon/features/account/components/header.jsx +++ b/app/javascript/mastodon/features/account/components/header.jsx @@ -24,7 +24,7 @@ import { Icon } from 'mastodon/components/icon'; import { IconButton } from 'mastodon/components/icon_button'; import { ShortNumber } from 'mastodon/components/short_number'; import DropdownMenuContainer from 'mastodon/containers/dropdown_menu_container'; -import { autoPlayGif, me, domain } from 'mastodon/initial_state'; +import { autoPlayGif, me, domain, isShowItem } from 'mastodon/initial_state'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/permissions'; import { WithRouterPropTypes } from 'mastodon/utils/react_router'; @@ -89,9 +89,9 @@ const titleFromAccount = account => { const messageForFollowButton = relationship => { if(!relationship) return messages.follow; - if (relationship.get('following') && relationship.get('followed_by')) { + if (relationship.get('following') && relationship.get('followed_by') && isShowItem('relationships')) { return messages.mutual; - } else if (!relationship.get('following') && relationship.get('followed_by')) { + } else if (!relationship.get('following') && relationship.get('followed_by') && isShowItem('relationships')) { return messages.followBack; } else if (relationship.get('following')) { return messages.unfollow; diff --git a/app/javascript/mastodon/features/followers/index.jsx b/app/javascript/mastodon/features/followers/index.jsx index 4885f9ca994693..1e98a61657c85b 100644 --- a/app/javascript/mastodon/features/followers/index.jsx +++ b/app/javascript/mastodon/features/followers/index.jsx @@ -10,6 +10,7 @@ import { debounce } from 'lodash'; import { TimelineHint } from 'mastodon/components/timeline_hint'; import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; +import { isHideItem, me } from 'mastodon/initial_state'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; import { getAccountHidden } from 'mastodon/selectors'; @@ -130,7 +131,8 @@ class Followers extends ImmutablePureComponent { let emptyMessage; - const forceEmptyState = blockedBy || suspended || hidden; + const isHideRelationships = isHideItem('relationships') && accountId === me; + const forceEmptyState = blockedBy || suspended || hidden || isHideRelationships; if (suspended) { emptyMessage = ; @@ -142,6 +144,8 @@ class Followers extends ImmutablePureComponent { emptyMessage = ; } else if (remote && accountIds.isEmpty()) { emptyMessage = ; + } else if (isHideRelationships) { + emptyMessage = ; } else { emptyMessage = ; } diff --git a/app/javascript/mastodon/features/following/index.jsx b/app/javascript/mastodon/features/following/index.jsx index fb4a4d5c3a664a..3e890e8d87b755 100644 --- a/app/javascript/mastodon/features/following/index.jsx +++ b/app/javascript/mastodon/features/following/index.jsx @@ -10,6 +10,7 @@ import { debounce } from 'lodash'; import { TimelineHint } from 'mastodon/components/timeline_hint'; import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; +import { isHideItem, me } from 'mastodon/initial_state'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; import { getAccountHidden } from 'mastodon/selectors'; @@ -131,6 +132,7 @@ class Following extends ImmutablePureComponent { let emptyMessage; const forceEmptyState = blockedBy || suspended || hidden; + const normalizedAccountIds = isHideItem('relationships') ? accountIds.filter((id) => id !== me) : accountIds; if (suspended) { emptyMessage = ; @@ -138,9 +140,9 @@ class Following extends ImmutablePureComponent { emptyMessage = ; } else if (blockedBy) { emptyMessage = ; - } else if (hideCollections && accountIds.isEmpty()) { + } else if (hideCollections && normalizedAccountIds.isEmpty()) { emptyMessage = ; - } else if (remote && accountIds.isEmpty()) { + } else if (remote && normalizedAccountIds.isEmpty()) { emptyMessage = ; } else { emptyMessage = ; @@ -163,7 +165,7 @@ class Following extends ImmutablePureComponent { emptyMessage={emptyMessage} bindToDocument={!multiColumn} > - {forceEmptyState ? [] : accountIds.map(id => + {forceEmptyState ? [] : normalizedAccountIds.map(id => , )} diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js index 7f9a0cdf0e8e9c..fecb20845afee8 100644 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/mastodon/initial_state.js @@ -10,6 +10,7 @@ * | 'quote_in_home' * | 'quote_in_public' * | 'recent_emojis' + * | 'relationships' * } HideItemsDefinition */ diff --git a/app/models/concerns/user/has_settings.rb b/app/models/concerns/user/has_settings.rb index 078afd4bde2b06..d37a5c61a36d0a 100644 --- a/app/models/concerns/user/has_settings.rb +++ b/app/models/concerns/user/has_settings.rb @@ -119,6 +119,10 @@ def setting_hide_blocking_quote settings['web.hide_blocking_quote'] end + def setting_show_relationships + settings['web.show_relationships'] + end + def setting_allow_quote settings['allow_quote'] end diff --git a/app/models/user_settings.rb b/app/models/user_settings.rb index 9398cc22c8e9a5..2fb0d39e059518 100644 --- a/app/models/user_settings.rb +++ b/app/models/user_settings.rb @@ -72,6 +72,7 @@ class KeyError < Error; end setting :simple_timeline_menu, default: false setting :show_quote_in_home, default: true setting :show_quote_in_public, default: false + setting :show_relationships, default: true setting :hide_blocking_quote, default: true setting :hide_emoji_reaction_unavailable_server, default: false setting :hide_favourite_menu, default: false diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index 39a323900c028a..bcdfb1f92b9cf1 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -46,6 +46,7 @@ def meta object_account_user.setting_show_emoji_reaction_on_timeline ? nil : 'emoji_reaction_on_timeline', object_account_user.setting_show_quote_in_home ? nil : 'quote_in_home', object_account_user.setting_show_quote_in_public ? nil : 'quote_in_public', + object_account_user.setting_show_relationships ? nil : 'relationships', ].compact else store[:auto_play_gif] = Setting.auto_play_gif diff --git a/app/views/settings/preferences/appearance/show.html.haml b/app/views/settings/preferences/appearance/show.html.haml index 84661e4f861756..13d86503acfb03 100644 --- a/app/views/settings/preferences/appearance/show.html.haml +++ b/app/views/settings/preferences/appearance/show.html.haml @@ -91,6 +91,7 @@ .fields-group = ff.input :'web.trends', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_trends') + = ff.input :'web.show_relationships', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_relationships') %h4= t 'appearance.confirmation_dialogs' diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index aa4b20c592ee7a..2127688ff413f6 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -287,6 +287,7 @@ en: setting_show_quote_in_home: Show quotes in home, list or antenna timelines setting_show_quote_in_public: Show quotes in public timelines setting_show_recent_emojis: Show recent emojis + setting_show_relationships: Show relationships on account page setting_show_statuses_count: Show statuses count setting_simple_timeline_menu: Reduce post menu on timeline setting_single_ref_to_quote: Deliver single reference to other server as quote diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index f0a7df267e5462..899f07cb21d114 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -289,6 +289,7 @@ ja: setting_show_quote_in_home: ホーム・リスト・アンテナなどで引用を表示する setting_show_quote_in_public: 公開タイムライン(ローカル・連合)で引用を表示する setting_show_recent_emojis: 絵文字ピッカーで絵文字デッキと一緒に、絵文字の使用履歴も表示する + setting_show_relationships: アカウント詳細ベージで、相手からのフォロー状況を表示する setting_show_statuses_count: 投稿数を公開する setting_stay_privacy: 投稿時に公開範囲を保存する setting_public_post_to_unlisted: サードパーティから公開範囲「公開」で投稿した場合、「ローカル公開」に変更する