From 45862024485273476f5cbbd7162a7fadefd4b3b5 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 16 Sep 2020 20:17:16 +0200 Subject: [Glitch] Fix notification filter bar incorrectly filtering gaps Port aab867b0e8119ecee78dabe8007f3c033e734b6d to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/features/notifications/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/javascript/flavours/glitch/features') diff --git a/app/javascript/flavours/glitch/features/notifications/index.js b/app/javascript/flavours/glitch/features/notifications/index.js index 681323860..475968caa 100644 --- a/app/javascript/flavours/glitch/features/notifications/index.js +++ b/app/javascript/flavours/glitch/features/notifications/index.js @@ -48,7 +48,7 @@ const getNotifications = createSelector([ // we need to turn it off for FilterBar in order not to block ourselves from seeing a specific category return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type'))); } - return notifications.filter(item => item !== null && allowedType === item.get('type')); + return notifications.filter(item => item === null || allowedType === item.get('type')); }); const mapStateToProps = state => ({ -- cgit From 6775de3fc98c46e26a07ed69f6f2459e6b1fce70 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 10 Sep 2020 00:07:19 +0200 Subject: [Glitch] Change web UI to show empty profile for suspended accounts Port fcb9350ff8cdc83388f75de6b031410df8aa8a56 to glitch-soc Signed-off-by: Thibaut Girka --- .../glitch/features/account/components/header.js | 76 ++++++++++++---------- .../glitch/features/account_gallery/index.js | 28 +++++--- .../glitch/features/account_timeline/index.js | 12 +++- 3 files changed, 69 insertions(+), 47 deletions(-) (limited to 'app/javascript/flavours/glitch/features') diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index 0af0935e6..88c578b59 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -134,6 +134,8 @@ class Header extends ImmutablePureComponent { const accountNote = account.getIn(['relationship', 'note']); + const suspended = account.get('suspended'); + let info = []; let actionBtn = ''; let lockedIcon = ''; @@ -170,17 +172,21 @@ class Header extends ImmutablePureComponent { actionBtn = ''; } + if (suspended && !account.getIn(['relationship', 'following'])) { + actionBtn = ''; + } + if (account.get('locked')) { lockedIcon = ; } - if (account.get('id') !== me) { + if (account.get('id') !== me && !suspended) { menu.push({ text: intl.formatMessage(messages.mention, { name: account.get('username') }), action: this.props.onMention }); menu.push({ text: intl.formatMessage(messages.direct, { name: account.get('username') }), action: this.props.onDirect }); menu.push(null); } - if ('share' in navigator) { + if ('share' in navigator && !suspended) { menu.push({ text: intl.formatMessage(messages.share, { name: account.get('username') }), action: this.handleShare }); menu.push(null); } @@ -297,39 +303,41 @@ class Header extends ImmutablePureComponent { -
-
- { (fields.size > 0 || identity_proofs.size > 0) && ( -
- {identity_proofs.map((proof, i) => ( -
-
- -
- - - - -
-
- ))} - {fields.map((pair, i) => ( -
-
- -
- {pair.get('verified_at') && } -
-
- ))} -
- )} - - {account.get('note').length > 0 && account.get('note') !== '

' &&
} + {!suspended && ( +
+
+ { (fields.size > 0 || identity_proofs.size > 0) && ( +
+ {identity_proofs.map((proof, i) => ( +
+
+ +
+ + + + +
+
+ ))} + {fields.map((pair, i) => ( +
+
+ +
+ {pair.get('verified_at') && } +
+
+ ))} +
+ )} + + {account.get('note').length > 0 && account.get('note') !== '

' &&
} +
-
-
-
+ )} +
+ ); } diff --git a/app/javascript/flavours/glitch/features/account_gallery/index.js b/app/javascript/flavours/glitch/features/account_gallery/index.js index 040741c2a..fda8082cc 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/index.js +++ b/app/javascript/flavours/glitch/features/account_gallery/index.js @@ -21,6 +21,7 @@ const mapStateToProps = (state, props) => ({ attachments: getAccountGallery(state, props.params.accountId), isLoading: state.getIn(['timelines', `account:${props.params.accountId}:media`, 'isLoading']), hasMore: state.getIn(['timelines', `account:${props.params.accountId}:media`, 'hasMore']), + suspended: state.getIn(['accounts', props.params.accountId, 'suspended'], false), }); class LoadMoreMedia extends ImmutablePureComponent { @@ -56,6 +57,7 @@ class AccountGallery extends ImmutablePureComponent { hasMore: PropTypes.bool, isAccount: PropTypes.bool, multiColumn: PropTypes.bool, + suspended: PropTypes.bool, }; state = { @@ -131,7 +133,7 @@ class AccountGallery extends ImmutablePureComponent { } render () { - const { attachments, isLoading, hasMore, isAccount, multiColumn } = this.props; + const { attachments, isLoading, hasMore, isAccount, multiColumn, suspended } = this.props; const { width } = this.state; if (!isAccount) { @@ -164,15 +166,21 @@ class AccountGallery extends ImmutablePureComponent {
-
- {attachments.map((attachment, index) => attachment === null ? ( - 0 ? attachments.getIn(index - 1, 'id') : null} onLoadMore={this.handleLoadMore} /> - ) : ( - - ))} - - {loadOlder} -
+ {suspended ? ( +
+ +
+ ) : ( +
+ {attachments.map((attachment, index) => attachment === null ? ( + 0 ? attachments.getIn(index - 1, 'id') : null} onLoadMore={this.handleLoadMore} /> + ) : ( + + ))} + + {loadOlder} +
+ )} {isLoading && attachments.size === 0 && (
diff --git a/app/javascript/flavours/glitch/features/account_timeline/index.js b/app/javascript/flavours/glitch/features/account_timeline/index.js index 5558ba2a3..c56cc9b8e 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/index.js +++ b/app/javascript/flavours/glitch/features/account_timeline/index.js @@ -17,6 +17,8 @@ import { fetchAccountIdentityProofs } from '../../actions/identity_proofs'; import MissingIndicator from 'flavours/glitch/components/missing_indicator'; import TimelineHint from 'flavours/glitch/components/timeline_hint'; +const emptyList = ImmutableList(); + const mapStateToProps = (state, { params: { accountId }, withReplies = false }) => { const path = withReplies ? `${accountId}:with_replies` : accountId; @@ -28,6 +30,7 @@ const mapStateToProps = (state, { params: { accountId }, withReplies = false }) featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], ImmutableList()), isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading']), hasMore: state.getIn(['timelines', `account:${path}`, 'hasMore']), + suspended: state.getIn(['accounts', accountId, 'suspended'], false), }; }; @@ -51,6 +54,7 @@ class AccountTimeline extends ImmutablePureComponent { hasMore: PropTypes.bool, withReplies: PropTypes.bool, isAccount: PropTypes.bool, + suspended: PropTypes.bool, remote: PropTypes.bool, remoteUrl: PropTypes.string, multiColumn: PropTypes.bool, @@ -91,7 +95,7 @@ class AccountTimeline extends ImmutablePureComponent { } render () { - const { statusIds, featuredStatusIds, isLoading, hasMore, isAccount, multiColumn, remote, remoteUrl } = this.props; + const { statusIds, featuredStatusIds, isLoading, hasMore, suspended, isAccount, multiColumn, remote, remoteUrl } = this.props; if (!isAccount) { return ( @@ -112,7 +116,9 @@ class AccountTimeline extends ImmutablePureComponent { let emptyMessage; - if (remote && statusIds.isEmpty()) { + if (suspended) { + emptyMessage = ; + } else if (remote && statusIds.isEmpty()) { emptyMessage = ; } else { emptyMessage = ; @@ -129,7 +135,7 @@ class AccountTimeline extends ImmutablePureComponent { alwaysPrepend append={remoteMessage} scrollKey='account_timeline' - statusIds={statusIds} + statusIds={suspended ? emptyList : statusIds} featuredStatusIds={featuredStatusIds} isLoading={isLoading} hasMore={hasMore} -- cgit From 14869ee656d03313882a912978e5478c628512f3 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 18 Sep 2020 17:26:45 +0200 Subject: [Glitch] Add option to be notified when a followed user posts Port 974b1b79ce58e6799e5e5bb576e630ca783150de to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/actions/accounts.js | 4 +-- .../flavours/glitch/actions/notifications.js | 2 +- .../flavours/glitch/components/status.js | 1 + .../flavours/glitch/components/status_prepend.js | 30 +++++++++++++++++++++- .../glitch/features/account/components/header.js | 12 ++++++++- .../features/account_timeline/components/header.js | 5 ++++ .../containers/header_container.js | 12 +++++++-- .../notifications/components/filter_bar.js | 8 ++++++ .../notifications/components/notification.js | 22 ++++++++++++++++ .../glitch/styles/components/accounts.scss | 4 +++ 10 files changed, 93 insertions(+), 7 deletions(-) (limited to 'app/javascript/flavours/glitch/features') diff --git a/app/javascript/flavours/glitch/actions/accounts.js b/app/javascript/flavours/glitch/actions/accounts.js index 1b4bff487..428b62f68 100644 --- a/app/javascript/flavours/glitch/actions/accounts.js +++ b/app/javascript/flavours/glitch/actions/accounts.js @@ -126,14 +126,14 @@ export function fetchAccountFail(id, error) { }; }; -export function followAccount(id, reblogs = true) { +export function followAccount(id, options = { reblogs: true }) { return (dispatch, getState) => { const alreadyFollowing = getState().getIn(['relationships', id, 'following']); const locked = getState().getIn(['accounts', id, 'locked'], false); dispatch(followAccountRequest(id, locked)); - api(getState).post(`/api/v1/accounts/${id}/follow`, { reblogs }).then(response => { + api(getState).post(`/api/v1/accounts/${id}/follow`, options).then(response => { dispatch(followAccountSuccess(response.data, alreadyFollowing)); }).catch(error => { dispatch(followAccountFail(error, locked)); diff --git a/app/javascript/flavours/glitch/actions/notifications.js b/app/javascript/flavours/glitch/actions/notifications.js index ccc427c29..7f311153b 100644 --- a/app/javascript/flavours/glitch/actions/notifications.js +++ b/app/javascript/flavours/glitch/actions/notifications.js @@ -73,7 +73,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) { let filtered = false; - if (notification.type === 'mention') { + if (['mention', 'status'].includes(notification.type)) { const dropRegex = filters[0]; const regex = filters[1]; const searchIndex = searchTextFromRawStatus(notification.status); diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js index 8da5db961..fc7940e5a 100644 --- a/app/javascript/flavours/glitch/components/status.js +++ b/app/javascript/flavours/glitch/components/status.js @@ -680,6 +680,7 @@ class Status extends ImmutablePureComponent { favourite: 'favourited', reblog: 'boosted', reblogged_by: 'boosted', + status: 'posted', }[prepend]; selectorAttribs[`data-${notifKind}-by`] = `@${account.get('acct')}`; diff --git a/app/javascript/flavours/glitch/components/status_prepend.js b/app/javascript/flavours/glitch/components/status_prepend.js index 637c4f23a..0ba55d5d8 100644 --- a/app/javascript/flavours/glitch/components/status_prepend.js +++ b/app/javascript/flavours/glitch/components/status_prepend.js @@ -64,6 +64,14 @@ export default class StatusPrepend extends React.PureComponent { values={{ name : link }} /> ); + case 'status': + return ( + + ); case 'poll': if (me === account.get('id')) { return ( @@ -88,12 +96,32 @@ export default class StatusPrepend extends React.PureComponent { const { Message } = this; const { type } = this.props; + let iconId; + + switch(type) { + case 'favourite': + iconId = 'star'; + break; + case 'featured': + iconId = 'thumb-tack'; + break; + case 'poll': + iconId = 'tasks'; + break; + case 'reblogged_by': + iconId = 'retweet'; + break; + case 'status': + iconId = 'bell'; + break; + }; + return !type ? null : (