diff --git a/app/javascript/mastodon/features/account_timeline/components/limited_account_hint.js b/app/javascript/mastodon/features/account_timeline/components/limited_account_hint.js
new file mode 100644
index 0000000000..6b025596ca
--- /dev/null
+++ b/app/javascript/mastodon/features/account_timeline/components/limited_account_hint.js
@@ -0,0 +1,35 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { connect } from 'react-redux';
+import { revealAccount } from 'mastodon/actions/accounts';
+import { FormattedMessage } from 'react-intl';
+import Button from 'mastodon/components/button';
+
+const mapDispatchToProps = (dispatch, { accountId }) => ({
+
+ reveal () {
+ dispatch(revealAccount(accountId));
+ },
+
+});
+
+export default @connect(() => {}, mapDispatchToProps)
+class LimitedAccountHint extends React.PureComponent {
+
+ static propTypes = {
+ accountId: PropTypes.string.isRequired,
+ reveal: PropTypes.func,
+ }
+
+ render () {
+ const { reveal } = this.props;
+
+ return (
+
+ );
+ }
+
+}
diff --git a/app/javascript/mastodon/features/account_timeline/containers/header_container.js b/app/javascript/mastodon/features/account_timeline/containers/header_container.js
index b3f8521cb9..371794dd75 100644
--- a/app/javascript/mastodon/features/account_timeline/containers/header_container.js
+++ b/app/javascript/mastodon/features/account_timeline/containers/header_container.js
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
-import { makeGetAccount } from '../../../selectors';
+import { makeGetAccount, getAccountHidden } from '../../../selectors';
import Header from '../components/header';
import {
followAccount,
@@ -33,6 +33,7 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, accountId),
domain: state.getIn(['meta', 'domain']),
+ hidden: getAccountHidden(state, accountId),
});
return mapStateToProps;
diff --git a/app/javascript/mastodon/features/account_timeline/index.js b/app/javascript/mastodon/features/account_timeline/index.js
index 5122aec4e9..5b592c5a76 100644
--- a/app/javascript/mastodon/features/account_timeline/index.js
+++ b/app/javascript/mastodon/features/account_timeline/index.js
@@ -16,6 +16,8 @@ import MissingIndicator from 'mastodon/components/missing_indicator';
import TimelineHint from 'mastodon/components/timeline_hint';
import { me } from 'mastodon/initial_state';
import { connectTimeline, disconnectTimeline } from 'mastodon/actions/timelines';
+import LimitedAccountHint from './components/limited_account_hint';
+import { getAccountHidden } from 'mastodon/selectors';
const emptyList = ImmutableList();
@@ -40,6 +42,7 @@ const mapStateToProps = (state, { params: { acct, id }, withReplies = false }) =
isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading']),
hasMore: state.getIn(['timelines', `account:${path}`, 'hasMore']),
suspended: state.getIn(['accounts', accountId, 'suspended'], false),
+ hidden: getAccountHidden(state, accountId),
blockedBy: state.getIn(['relationships', accountId, 'blocked_by'], false),
};
};
@@ -70,6 +73,7 @@ class AccountTimeline extends ImmutablePureComponent {
blockedBy: PropTypes.bool,
isAccount: PropTypes.bool,
suspended: PropTypes.bool,
+ hidden: PropTypes.bool,
remote: PropTypes.bool,
remoteUrl: PropTypes.string,
multiColumn: PropTypes.bool,
@@ -128,7 +132,7 @@ class AccountTimeline extends ImmutablePureComponent {
}
render () {
- const { statusIds, featuredStatusIds, isLoading, hasMore, blockedBy, suspended, isAccount, multiColumn, remote, remoteUrl } = this.props;
+ const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, blockedBy, suspended, isAccount, hidden, multiColumn, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
@@ -149,8 +153,12 @@ class AccountTimeline extends ImmutablePureComponent {
let emptyMessage;
+ const forceEmptyState = suspended || blockedBy || hidden;
+
if (suspended) {
emptyMessage =
;
+ } else if (hidden) {
+ emptyMessage =
;
} else if (blockedBy) {
emptyMessage =
;
} else if (remote && statusIds.isEmpty()) {
@@ -166,14 +174,14 @@ class AccountTimeline extends ImmutablePureComponent {
}
+ prepend={
}
alwaysPrepend
append={remoteMessage}
scrollKey='account_timeline'
- statusIds={(suspended || blockedBy) ? emptyList : statusIds}
+ statusIds={forceEmptyState ? emptyList : statusIds}
featuredStatusIds={featuredStatusIds}
isLoading={isLoading}
- hasMore={hasMore}
+ hasMore={!forceEmptyState && hasMore}
onLoadMore={this.handleLoadMore}
emptyMessage={emptyMessage}
bindToDocument={!multiColumn}
diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js
index 224e74b3dd..5b7f402f8d 100644
--- a/app/javascript/mastodon/features/followers/index.js
+++ b/app/javascript/mastodon/features/followers/index.js
@@ -19,6 +19,8 @@ import ColumnBackButton from '../../components/column_back_button';
import ScrollableList from '../../components/scrollable_list';
import MissingIndicator from 'mastodon/components/missing_indicator';
import TimelineHint from 'mastodon/components/timeline_hint';
+import LimitedAccountHint from '../account_timeline/components/limited_account_hint';
+import { getAccountHidden } from 'mastodon/selectors';
const mapStateToProps = (state, { params: { acct, id } }) => {
const accountId = id || state.getIn(['accounts_map', acct]);
@@ -37,6 +39,8 @@ const mapStateToProps = (state, { params: { acct, id } }) => {
accountIds: state.getIn(['user_lists', 'followers', accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'followers', accountId, 'next']),
isLoading: state.getIn(['user_lists', 'followers', accountId, 'isLoading'], true),
+ suspended: state.getIn(['accounts', accountId, 'suspended'], false),
+ hidden: getAccountHidden(state, accountId),
blockedBy: state.getIn(['relationships', accountId, 'blocked_by'], false),
};
};
@@ -64,6 +68,8 @@ class Followers extends ImmutablePureComponent {
isLoading: PropTypes.bool,
blockedBy: PropTypes.bool,
isAccount: PropTypes.bool,
+ suspended: PropTypes.bool,
+ hidden: PropTypes.bool,
remote: PropTypes.bool,
remoteUrl: PropTypes.string,
multiColumn: PropTypes.bool,
@@ -101,7 +107,7 @@ class Followers extends ImmutablePureComponent {
}, 300, { leading: true });
render () {
- const { accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, remote, remoteUrl } = this.props;
+ const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
@@ -121,7 +127,13 @@ class Followers extends ImmutablePureComponent {
let emptyMessage;
- if (blockedBy) {
+ const forceEmptyState = blockedBy || suspended || hidden;
+
+ if (suspended) {
+ emptyMessage =
;
+ } else if (hidden) {
+ emptyMessage =
;
+ } else if (blockedBy) {
emptyMessage =
;
} else if (remote && accountIds.isEmpty()) {
emptyMessage =
;
@@ -137,7 +149,7 @@ class Followers extends ImmutablePureComponent {
}
@@ -146,7 +158,7 @@ class Followers extends ImmutablePureComponent {
emptyMessage={emptyMessage}
bindToDocument={!multiColumn}
>
- {blockedBy ? [] : accountIds.map(id =>
+ {forceEmptyState ? [] : accountIds.map(id =>
,
)}
diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js
index aadce1644f..143082d760 100644
--- a/app/javascript/mastodon/features/following/index.js
+++ b/app/javascript/mastodon/features/following/index.js
@@ -19,6 +19,8 @@ import ColumnBackButton from '../../components/column_back_button';
import ScrollableList from '../../components/scrollable_list';
import MissingIndicator from 'mastodon/components/missing_indicator';
import TimelineHint from 'mastodon/components/timeline_hint';
+import LimitedAccountHint from '../account_timeline/components/limited_account_hint';
+import { getAccountHidden } from 'mastodon/selectors';
const mapStateToProps = (state, { params: { acct, id } }) => {
const accountId = id || state.getIn(['accounts_map', acct]);
@@ -37,6 +39,8 @@ const mapStateToProps = (state, { params: { acct, id } }) => {
accountIds: state.getIn(['user_lists', 'following', accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'following', accountId, 'next']),
isLoading: state.getIn(['user_lists', 'following', accountId, 'isLoading'], true),
+ suspended: state.getIn(['accounts', accountId, 'suspended'], false),
+ hidden: getAccountHidden(state, accountId),
blockedBy: state.getIn(['relationships', accountId, 'blocked_by'], false),
};
};
@@ -64,6 +68,8 @@ class Following extends ImmutablePureComponent {
isLoading: PropTypes.bool,
blockedBy: PropTypes.bool,
isAccount: PropTypes.bool,
+ suspended: PropTypes.bool,
+ hidden: PropTypes.bool,
remote: PropTypes.bool,
remoteUrl: PropTypes.string,
multiColumn: PropTypes.bool,
@@ -101,7 +107,7 @@ class Following extends ImmutablePureComponent {
}, 300, { leading: true });
render () {
- const { accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, remote, remoteUrl } = this.props;
+ const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
@@ -121,7 +127,13 @@ class Following extends ImmutablePureComponent {
let emptyMessage;
- if (blockedBy) {
+ const forceEmptyState = blockedBy || suspended || hidden;
+
+ if (suspended) {
+ emptyMessage =
;
+ } else if (hidden) {
+ emptyMessage =
;
+ } else if (blockedBy) {
emptyMessage =
;
} else if (remote && accountIds.isEmpty()) {
emptyMessage =
;
@@ -137,7 +149,7 @@ class Following extends ImmutablePureComponent {
}
@@ -146,7 +158,7 @@ class Following extends ImmutablePureComponent {
emptyMessage={emptyMessage}
bindToDocument={!multiColumn}
>
- {blockedBy ? [] : accountIds.map(id =>
+ {forceEmptyState ? [] : accountIds.map(id =>
,
)}
diff --git a/app/javascript/mastodon/reducers/accounts.js b/app/javascript/mastodon/reducers/accounts.js
index 530ed8e607..b5589668c1 100644
--- a/app/javascript/mastodon/reducers/accounts.js
+++ b/app/javascript/mastodon/reducers/accounts.js
@@ -1,4 +1,5 @@
-import { ACCOUNT_IMPORT, ACCOUNTS_IMPORT } from '../actions/importer';
+import { ACCOUNT_IMPORT, ACCOUNTS_IMPORT } from 'mastodon/actions/importer';
+import { ACCOUNT_REVEAL } from 'mastodon/actions/accounts';
import { Map as ImmutableMap, fromJS } from 'immutable';
const initialState = ImmutableMap();
@@ -10,6 +11,8 @@ const normalizeAccount = (state, account) => {
delete account.following_count;
delete account.statuses_count;
+ account.hidden = state.getIn([account.id, 'hidden']) === false ? false : account.limited;
+
return state.set(account.id, fromJS(account));
};
@@ -27,6 +30,8 @@ export default function accounts(state = initialState, action) {
return normalizeAccount(state, action.account);
case ACCOUNTS_IMPORT:
return normalizeAccounts(state, action.accounts);
+ case ACCOUNT_REVEAL:
+ return state.setIn([action.id, 'hidden'], false);
default:
return state;
}
diff --git a/app/javascript/mastodon/selectors/index.js b/app/javascript/mastodon/selectors/index.js
index 1e19db65d0..3121774b3d 100644
--- a/app/javascript/mastodon/selectors/index.js
+++ b/app/javascript/mastodon/selectors/index.js
@@ -175,3 +175,11 @@ export const getAccountGallery = createSelector([
return medias;
});
+
+export const getAccountHidden = createSelector([
+ (state, id) => state.getIn(['accounts', id, 'hidden']),
+ (state, id) => state.getIn(['relationships', id, 'following']) || state.getIn(['relationships', id, 'requested']),
+ (state, id) => id === me,
+], (hidden, followingOrRequested, isSelf) => {
+ return hidden && !(isSelf || followingOrRequested);
+});
diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss
index b53648ead1..1a1cec6db2 100644
--- a/app/javascript/styles/mastodon/components.scss
+++ b/app/javascript/styles/mastodon/components.scss
@@ -4037,6 +4037,15 @@ a.status-card.compact:hover {
vertical-align: middle;
}
+.limited-account-hint {
+ p {
+ color: $secondary-text-color;
+ font-size: 15px;
+ font-weight: 500;
+ margin-bottom: 20px;
+ }
+}
+
.empty-column-indicator,
.error-column,
.follow_requests-unlocked_explanation {
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index 4cf7b253fa..c52a89d872 100644
--- a/app/serializers/rest/account_serializer.rb
+++ b/app/serializers/rest/account_serializer.rb
@@ -13,6 +13,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
has_many :emojis, serializer: REST::CustomEmojiSerializer
attribute :suspended, if: :suspended?
+ attribute :silenced, key: :limited, if: :silenced?
class FieldSerializer < ActiveModel::Serializer
include FormattingHelper
@@ -98,7 +99,11 @@ class REST::AccountSerializer < ActiveModel::Serializer
object.suspended?
end
- delegate :suspended?, to: :object
+ def silenced
+ object.silenced?
+ end
+
+ delegate :suspended?, :silenced?, to: :object
def moved_and_not_nested?
object.moved? && object.moved_to_account.moved_to_account_id.nil?