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..4fc27d0cc2e5be 100644 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/mastodon/initial_state.js @@ -2,7 +2,8 @@ /** - * @typedef { 'blocking_quote' + * @typedef { + * | 'blocking_quote' * | 'emoji_reaction_on_timeline' * | 'emoji_reaction_unavailable_server' * | 'emoji_reaction_count' @@ -10,6 +11,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 48e2f57c85a671..67c85702d5a409 100644 --- a/app/models/user_settings.rb +++ b/app/models/user_settings.rb @@ -69,6 +69,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 b126130f2c06b5..8fb64ab8504ccb 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 8aced089f61fca..6a21bf486822ee 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -288,6 +288,7 @@ en: setting_show_emoji_reaction_on_timeline: Show all emoji reactions on timeline 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_relationships: Show relationships on account page setting_simple_timeline_menu: Reduce post menu on timeline setting_single_ref_to_quote: Deliver single reference to other server as quote setting_slip_local_emoji_reaction: Allow bypassing emoji reaction from local users diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index 2fae3f630e221a..1fb1e385f5476b 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -290,6 +290,7 @@ ja: setting_lock_follow_from_bot: botからのフォローを承認制にする setting_show_quote_in_home: ホーム・リスト・アンテナなどで引用を表示する setting_show_quote_in_public: 公開タイムライン(ローカル・連合)で引用を表示する + setting_show_relationships: アカウント詳細ベージで、相手からのフォロー状況を表示する setting_stay_privacy: 投稿時に公開範囲を保存する setting_public_post_to_unlisted: サードパーティから公開範囲「公開」で投稿した場合、「ローカル公開」に変更する setting_reduce_motion: アニメーションの動きを減らす