From 25c5223617904319f52b455bf0b5c725077ea880 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Mon, 5 Mar 2018 11:09:29 +0100 Subject: [PATCH] Port #6627 and #6636 to glitch-soc --- .../features/account/components/header.js | 19 +++++++++++++++++++ .../account_timeline/components/header.js | 1 + .../glitch/styles/components/accounts.scss | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index 767e4da47..f346bd108 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -15,6 +15,7 @@ const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, follow: { id: 'account.follow', defaultMessage: 'Follow' }, requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, + unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' }, }); @injectIntl @@ -23,6 +24,7 @@ export default class Header extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.map, onFollow: PropTypes.func.isRequired, + onBlock: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; @@ -35,11 +37,21 @@ export default class Header extends ImmutablePureComponent { let displayName = account.get('display_name_html'); let info = ''; + let mutingInfo = ''; let actionBtn = ''; if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { info = ; } + else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) { + info = ; + } + + if (me !== account.get('id') && account.getIn(['relationship', 'muting'])) { + mutingInfo = ; + } else if (me !== account.get('id') && account.getIn(['relationship', 'domain_blocking'])) { + mutingInfo = ; + } if (me !== account.get('id')) { if (account.getIn(['relationship', 'requested'])) { @@ -54,6 +66,12 @@ export default class Header extends ImmutablePureComponent { ); + } else if (account.getIn(['relationship', 'blocking'])) { + actionBtn = ( +
+ +
+ ); } } @@ -78,6 +96,7 @@ export default class Header extends ImmutablePureComponent {
{info} + {mutingInfo} {actionBtn}
diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/header.js b/app/javascript/flavours/glitch/features/account_timeline/components/header.js index 4ad677fbe..092034664 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/header.js +++ b/app/javascript/flavours/glitch/features/account_timeline/components/header.js @@ -76,6 +76,7 @@ export default class Header extends ImmutablePureComponent {