]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix block/mute lists showing a follow button when unblocking a user (#18364)
authorClaire <claire.github-309c@sitedethib.com>
Mon, 9 May 2022 21:20:19 +0000 (23:20 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Fri, 27 May 2022 03:41:35 +0000 (23:41 -0400)
Port 662ed53c18b39bb0c89cf18ede3436af15ee3447 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/components/account.js
app/javascript/flavours/glitch/features/blocks/index.js
app/javascript/flavours/glitch/features/mutes/index.js

index 396a36ea0fd91266d1603361689d5fa1ec4565b8..489f607363ad594f3de11f1913c39b9f288c5b60 100644 (file)
@@ -16,8 +16,10 @@ const messages = defineMessages({
   requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' },
   unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
   unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
-  mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'You are not currently muting notifications from @{name}. Click to mute notifications' },
-  unmute_notifications: { id: 'account.unmute_notifications', defaultMessage: 'You are currently muting notifications from @{name}. Click to unmute notifications' },
+  mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'Mute notifications from @{name}' },
+  unmute_notifications: { id: 'account.unmute_notifications', defaultMessage: 'Unmute notifications from @{name}' },
+  mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
+  block: { id: 'account.block', defaultMessage: 'Block @{name}' },
 });
 
 export default @injectIntl
@@ -34,6 +36,7 @@ class Account extends ImmutablePureComponent {
     small: PropTypes.bool,
     actionIcon: PropTypes.string,
     actionTitle: PropTypes.string,
+    defaultAction: PropTypes.string,
     onActionClick: PropTypes.func,
   };
 
@@ -70,6 +73,7 @@ class Account extends ImmutablePureComponent {
       onActionClick,
       actionIcon,
       actionTitle,
+      defaultAction,
     } = this.props;
 
     if (!account) {
@@ -114,6 +118,10 @@ class Account extends ImmutablePureComponent {
             {hidingNotificationsButton}
           </Fragment>
         );
+      } else if (defaultAction === 'mute') {
+        buttons = <IconButton icon='volume-off' title={intl.formatMessage(messages.mute, { name: account.get('username') })} onClick={this.handleMute} />;
+      } else if (defaultAction === 'block') {
+        buttons = <IconButton icon='lock' title={intl.formatMessage(messages.block, { name: account.get('username') })} onClick={this.handleBlock} />;
       } else if (!account.get('moved') || following) {
         buttons = <IconButton icon={following ? 'user-times' : 'user-plus'} title={intl.formatMessage(following ? messages.unfollow : messages.follow)} onClick={this.handleFollow} active={following} />;
       }
index 4d0f58239b16998e5665cdfaeba033e703715a5c..4461bd14d89f00809910412b5116c0853a290ffa 100644 (file)
@@ -69,7 +69,7 @@ class Blocks extends ImmutablePureComponent {
           bindToDocument={!multiColumn}
         >
           {accountIds.map(id =>
-            <AccountContainer key={id} id={id} />,
+            <AccountContainer key={id} id={id} defaultAction='block' />,
           )}
         </ScrollableList>
       </Column>
index 9f0d5a43ef0da0014389f2563b044c106e28d096..764cbef1a28f04747c9735dd830cb16be6fb7616 100644 (file)
@@ -69,7 +69,7 @@ class Mutes extends ImmutablePureComponent {
           bindToDocument={!multiColumn}
         >
           {accountIds.map(id =>
-            <AccountContainer key={id} id={id} />,
+            <AccountContainer key={id} id={id} defaultAction='mute' />,
           )}
         </ScrollableList>
       </Column>