about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/account.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-10-23 00:08:39 +0200
committerThibG <thib@sitedethib.com>2019-04-22 20:15:47 +0200
commit9b9816aba6c97eae9ea35698b185fe3deb3a870a (patch)
treeea009d33977dde6d877a4021e3232bf5555efe58 /app/javascript/flavours/glitch/components/account.js
parent149aa07409ef7cd17098a28510e515530b173f13 (diff)
[Glitch] Show suggested follows on search screen in mobile layout
Port ad510db3a19640267f94062756d558a45472af14 to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/components/account.js')
-rw-r--r--app/javascript/flavours/glitch/components/account.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/account.js b/app/javascript/flavours/glitch/components/account.js
index 4fcafc509..3fc18cb72 100644
--- a/app/javascript/flavours/glitch/components/account.js
+++ b/app/javascript/flavours/glitch/components/account.js
@@ -31,6 +31,9 @@ export default class Account extends ImmutablePureComponent {
     intl: PropTypes.object.isRequired,
     hidden: PropTypes.bool,
     small: PropTypes.bool,
+    actionIcon: PropTypes.string,
+    actionTitle: PropTypes.string,
+    onActionClick: PropTypes.func,
   };
 
   handleFollow = () => {
@@ -53,12 +56,19 @@ export default class Account extends ImmutablePureComponent {
     this.props.onMuteNotifications(this.props.account, false);
   }
 
+  handleAction = () => {
+    this.props.onActionClick(this.props.account);
+  }
+
   render () {
     const {
       account,
       hidden,
       intl,
       small,
+      onActionClick,
+      actionIcon,
+      actionTitle,
     } = this.props;
 
     if (!account) {
@@ -76,7 +86,9 @@ export default class Account extends ImmutablePureComponent {
 
     let buttons;
 
-    if (account.get('id') !== me && !small && account.get('relationship', null) !== null) {
+    if (onActionClick && actionIcon) {
+      buttons = <IconButton icon={actionIcon} title={actionTitle} onClick={this.handleAction} />;
+    } else if (account.get('id') !== me && !small && account.get('relationship', null) !== null) {
       const following = account.getIn(['relationship', 'following']);
       const requested = account.getIn(['relationship', 'requested']);
       const blocking  = account.getIn(['relationship', 'blocking']);