about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/notifications/components/notification.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-01-27 17:54:54 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-01-27 17:54:54 +0100
commitec5bd8b8bbe5a7500680eeab40ce36f28373d0ba (patch)
tree3d12985a7c99466d4649e9a8e14bb0f6c21296ba /app/javascript/mastodon/features/notifications/components/notification.js
parente2a5be6e9a070792fa72711c812f75bc61990052 (diff)
Implement missing hotkeys for notifications (#9927)
Diffstat (limited to 'app/javascript/mastodon/features/notifications/components/notification.js')
-rw-r--r--app/javascript/mastodon/features/notifications/components/notification.js30
1 files changed, 26 insertions, 4 deletions
diff --git a/app/javascript/mastodon/features/notifications/components/notification.js b/app/javascript/mastodon/features/notifications/components/notification.js
index 44da423ad..97efff69c 100644
--- a/app/javascript/mastodon/features/notifications/components/notification.js
+++ b/app/javascript/mastodon/features/notifications/components/notification.js
@@ -29,6 +29,10 @@ class Notification extends ImmutablePureComponent {
     onMoveUp: PropTypes.func.isRequired,
     onMoveDown: PropTypes.func.isRequired,
     onMention: PropTypes.func.isRequired,
+    onFavourite: PropTypes.func.isRequired,
+    onReblog: PropTypes.func.isRequired,
+    onToggleHidden: PropTypes.func.isRequired,
+    status: PropTypes.option,
     intl: PropTypes.object.isRequired,
   };
 
@@ -64,14 +68,32 @@ class Notification extends ImmutablePureComponent {
     onMention(notification.get('account'), this.context.router.history);
   }
 
+  handleHotkeyFavourite = () => {
+    const { status } = this.props;
+    if (status) this.props.onFavourite(status);
+  }
+
+  handleHotkeyBoost = e => {
+    const { status } = this.props;
+    if (status) this.props.onReblog(status, e);
+  }
+
+  handleHotkeyToggleHidden = () => {
+    const { status } = this.props;
+    if (status) this.props.onToggleHidden(status);
+  }
+
   getHandlers () {
     return {
-      moveUp: this.handleMoveUp,
-      moveDown: this.handleMoveDown,
+      reply: this.handleMention,
+      favourite: this.handleHotkeyFavourite,
+      boost: this.handleHotkeyBoost,
+      mention: this.handleMention,
       open: this.handleOpen,
       openProfile: this.handleOpenProfile,
-      mention: this.handleMention,
-      reply: this.handleMention,
+      moveUp: this.handleMoveUp,
+      moveDown: this.handleMoveDown,
+      toggleHidden: this.handleHotkeyToggleHidden,
     };
   }