diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.js b/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.js
new file mode 100644
index 00000000000..e465c83b47c
--- /dev/null
+++ b/app/javascript/flavours/glitch/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 'flavours/glitch/actions/accounts';
+import { FormattedMessage } from 'react-intl';
+import Button from 'flavours/glitch/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/flavours/glitch/features/account_timeline/containers/header_container.js b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js
index d5858e1c273..3fa7c1448b1 100644
--- a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js
+++ b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
-import { makeGetAccount } from 'flavours/glitch/selectors';
+import { makeGetAccount, getAccountHidden } from 'flavours/glitch/selectors';
import Header from '../components/header';
import {
followAccount,
@@ -34,6 +34,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/flavours/glitch/features/account_timeline/index.js b/app/javascript/flavours/glitch/features/account_timeline/index.js
index 90374a86b53..68d558e6620 100644
--- a/app/javascript/flavours/glitch/features/account_timeline/index.js
+++ b/app/javascript/flavours/glitch/features/account_timeline/index.js
@@ -15,6 +15,8 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage } from 'react-intl';
import MissingIndicator from 'flavours/glitch/components/missing_indicator';
import TimelineHint from 'flavours/glitch/components/timeline_hint';
+import LimitedAccountHint from './components/limited_account_hint';
+import { getAccountHidden } from 'flavours/glitch/selectors';
const emptyList = ImmutableList();
@@ -39,6 +41,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),
};
};
@@ -67,6 +70,7 @@ class AccountTimeline extends ImmutablePureComponent {
withReplies: PropTypes.bool,
isAccount: PropTypes.bool,
suspended: PropTypes.bool,
+ hidden: PropTypes.bool,
remote: PropTypes.bool,
remoteUrl: PropTypes.string,
multiColumn: PropTypes.bool,
@@ -130,7 +134,7 @@ class AccountTimeline extends ImmutablePureComponent {
}
render () {
- const { statusIds, featuredStatusIds, isLoading, hasMore, suspended, isAccount, multiColumn, remote, remoteUrl } = this.props;
+ const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, suspended, isAccount, hidden, multiColumn, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
@@ -151,8 +155,12 @@ class AccountTimeline extends ImmutablePureComponent {
let emptyMessage;
+ const forceEmptyState = suspended || hidden;
+
if (suspended) {
emptyMessage =
;
+ } else if (hidden) {
+ emptyMessage =
;
} else if (remote && statusIds.isEmpty()) {
emptyMessage =
;
} else {
@@ -166,14 +174,14 @@ class AccountTimeline extends ImmutablePureComponent {
}
+ prepend={
}
alwaysPrepend
append={remoteMessage}
scrollKey='account_timeline'
- statusIds={suspended ? 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/flavours/glitch/features/followers/index.js b/app/javascript/flavours/glitch/features/followers/index.js
index 978436dccc2..27a63b3fdd7 100644
--- a/app/javascript/flavours/glitch/features/followers/index.js
+++ b/app/javascript/flavours/glitch/features/followers/index.js
@@ -19,6 +19,8 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import MissingIndicator from 'flavours/glitch/components/missing_indicator';
import ScrollableList from 'flavours/glitch/components/scrollable_list';
import TimelineHint from 'flavours/glitch/components/timeline_hint';
+import LimitedAccountHint from '../account_timeline/components/limited_account_hint';
+import { getAccountHidden } from 'flavours/glitch/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),
};
};
@@ -62,6 +66,8 @@ class Followers extends ImmutablePureComponent {
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
isAccount: PropTypes.bool,
+ suspended: PropTypes.bool,
+ hidden: PropTypes.bool,
remote: PropTypes.bool,
remoteUrl: PropTypes.string,
multiColumn: PropTypes.bool,
@@ -107,7 +113,7 @@ class Followers extends ImmutablePureComponent {
}
render () {
- const { accountIds, hasMore, isAccount, multiColumn, isLoading, remote, remoteUrl } = this.props;
+ const { accountId, accountIds, hasMore, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
@@ -127,7 +133,13 @@ class Followers extends ImmutablePureComponent {
let emptyMessage;
- if (remote && accountIds.isEmpty()) {
+ const forceEmptyState = suspended || hidden;
+
+ if (suspended) {
+ emptyMessage =
;
+ } else if (hidden) {
+ emptyMessage =
;
+ } else if (remote && accountIds.isEmpty()) {
emptyMessage =
;
} else {
emptyMessage =
;
@@ -141,7 +153,7 @@ class Followers extends ImmutablePureComponent {
}
diff --git a/app/javascript/flavours/glitch/features/following/index.js b/app/javascript/flavours/glitch/features/following/index.js
index 446a19894bf..aa187bf9570 100644
--- a/app/javascript/flavours/glitch/features/following/index.js
+++ b/app/javascript/flavours/glitch/features/following/index.js
@@ -19,6 +19,8 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import MissingIndicator from 'flavours/glitch/components/missing_indicator';
import ScrollableList from 'flavours/glitch/components/scrollable_list';
import TimelineHint from 'flavours/glitch/components/timeline_hint';
+import LimitedAccountHint from '../account_timeline/components/limited_account_hint';
+import { getAccountHidden } from 'flavours/glitch/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),
};
};
@@ -62,6 +66,8 @@ class Following extends ImmutablePureComponent {
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
isAccount: PropTypes.bool,
+ suspended: PropTypes.bool,
+ hidden: PropTypes.bool,
remote: PropTypes.bool,
remoteUrl: PropTypes.string,
multiColumn: PropTypes.bool,
@@ -107,7 +113,7 @@ class Following extends ImmutablePureComponent {
}
render () {
- const { accountIds, hasMore, isAccount, multiColumn, isLoading, remote, remoteUrl } = this.props;
+ const { accountId, accountIds, hasMore, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
@@ -127,7 +133,13 @@ class Following extends ImmutablePureComponent {
let emptyMessage;
- if (remote && accountIds.isEmpty()) {
+ const forceEmptyState = suspended || hidden;
+
+ if (suspended) {
+ emptyMessage =
;
+ } else if (hidden) {
+ emptyMessage =
;
+ } else if (remote && accountIds.isEmpty()) {
emptyMessage =
;
} else {
emptyMessage =
;
@@ -141,7 +153,7 @@ class Following extends ImmutablePureComponent {
}
diff --git a/app/javascript/flavours/glitch/reducers/accounts.js b/app/javascript/flavours/glitch/reducers/accounts.js
index 530ed8e6077..e02a5592ee3 100644
--- a/app/javascript/flavours/glitch/reducers/accounts.js
+++ b/app/javascript/flavours/glitch/reducers/accounts.js
@@ -1,4 +1,5 @@
-import { ACCOUNT_IMPORT, ACCOUNTS_IMPORT } from '../actions/importer';
+import { ACCOUNT_IMPORT, ACCOUNTS_IMPORT } from 'flavours/glitch/actions/importer';
+import { ACCOUNT_REVEAL } from 'flavours/glitch/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/flavours/glitch/selectors/index.js b/app/javascript/flavours/glitch/selectors/index.js
index bb9180d1206..99afe535510 100644
--- a/app/javascript/flavours/glitch/selectors/index.js
+++ b/app/javascript/flavours/glitch/selectors/index.js
@@ -194,3 +194,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/flavours/glitch/styles/components/columns.scss b/app/javascript/flavours/glitch/styles/components/columns.scss
index 96e292d8b6e..d52ecf02c64 100644
--- a/app/javascript/flavours/glitch/styles/components/columns.scss
+++ b/app/javascript/flavours/glitch/styles/components/columns.scss
@@ -560,6 +560,15 @@
}
}
+.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 {