diff --git a/app/javascript/mastodon/api_types/accounts.ts b/app/javascript/mastodon/api_types/accounts.ts index ce55dc604..985abf946 100644 --- a/app/javascript/mastodon/api_types/accounts.ts +++ b/app/javascript/mastodon/api_types/accounts.ts @@ -42,4 +42,5 @@ export interface ApiAccountJSON { suspended?: boolean; limited?: boolean; memorial?: boolean; + hide_collections: boolean; } diff --git a/app/javascript/mastodon/features/followers/index.jsx b/app/javascript/mastodon/features/followers/index.jsx index e50b2171a..4885f9ca9 100644 --- a/app/javascript/mastodon/features/followers/index.jsx +++ b/app/javascript/mastodon/features/followers/index.jsx @@ -45,6 +45,7 @@ const mapStateToProps = (state, { params: { acct, id } }) => { hasMore: !!state.getIn(['user_lists', 'followers', accountId, 'next']), isLoading: state.getIn(['user_lists', 'followers', accountId, 'isLoading'], true), suspended: state.getIn(['accounts', accountId, 'suspended'], false), + hideCollections: state.getIn(['accounts', accountId, 'hide_collections'], false), hidden: getAccountHidden(state, accountId), blockedBy: state.getIn(['relationships', accountId, 'blocked_by'], false), }; @@ -111,7 +112,7 @@ class Followers extends ImmutablePureComponent { }, 300, { leading: true }); render () { - const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props; + const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl, hideCollections } = this.props; if (!isAccount) { return ( @@ -137,6 +138,8 @@ class Followers extends ImmutablePureComponent { emptyMessage = ; } else if (blockedBy) { emptyMessage = ; + } else if (hideCollections && accountIds.isEmpty()) { + emptyMessage = ; } else if (remote && accountIds.isEmpty()) { emptyMessage = ; } else { diff --git a/app/javascript/mastodon/features/following/index.jsx b/app/javascript/mastodon/features/following/index.jsx index 73e77aadd..fb4a4d5c3 100644 --- a/app/javascript/mastodon/features/following/index.jsx +++ b/app/javascript/mastodon/features/following/index.jsx @@ -45,6 +45,7 @@ const mapStateToProps = (state, { params: { acct, id } }) => { hasMore: !!state.getIn(['user_lists', 'following', accountId, 'next']), isLoading: state.getIn(['user_lists', 'following', accountId, 'isLoading'], true), suspended: state.getIn(['accounts', accountId, 'suspended'], false), + hideCollections: state.getIn(['accounts', accountId, 'hide_collections'], false), hidden: getAccountHidden(state, accountId), blockedBy: state.getIn(['relationships', accountId, 'blocked_by'], false), }; @@ -111,7 +112,7 @@ class Following extends ImmutablePureComponent { }, 300, { leading: true }); render () { - const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props; + const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl, hideCollections } = this.props; if (!isAccount) { return ( @@ -137,6 +138,8 @@ class Following extends ImmutablePureComponent { emptyMessage = ; } else if (blockedBy) { emptyMessage = ; + } else if (hideCollections && accountIds.isEmpty()) { + emptyMessage = ; } else if (remote && accountIds.isEmpty()) { emptyMessage = ; } else { diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 4399b9995..9cbaf9305 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -222,6 +222,7 @@ "emoji_button.search_results": "Search results", "emoji_button.symbols": "Symbols", "emoji_button.travel": "Travel & Places", + "empty_column.account_hides_collections": "This user has chosen to not make this information available", "empty_column.account_suspended": "Account suspended", "empty_column.account_timeline": "No posts here!", "empty_column.account_unavailable": "Profile unavailable", diff --git a/app/javascript/mastodon/models/account.ts b/app/javascript/mastodon/models/account.ts index f20d2a2d3..00066e284 100644 --- a/app/javascript/mastodon/models/account.ts +++ b/app/javascript/mastodon/models/account.ts @@ -93,6 +93,7 @@ export const accountDefaultValues: AccountShape = { memorial: false, limited: false, moved: null, + hide_collections: false, }; const AccountFactory = ImmutableRecord(accountDefaultValues); diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 435ae36b7..8c6520b30 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -8,7 +8,7 @@ class REST::AccountSerializer < ActiveModel::Serializer attributes :id, :username, :acct, :display_name, :locked, :bot, :discoverable, :group, :created_at, :note, :url, :uri, :avatar, :avatar_static, :header, :header_static, - :followers_count, :following_count, :statuses_count, :last_status_at + :followers_count, :following_count, :statuses_count, :last_status_at, :hide_collections has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?