From 6bfb7ea3a91187a3f95f22b16933530eb784e06f Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Wed, 21 Jun 2017 10:38:19 -0400
Subject: Fix JS error when hovering over reactions (#6710)

* Fix JS error when hovering over reactions

* Fix autocomplete for custom emojis

* Update to latest mattermost-redux
---
 webapp/components/post_view/reaction/reaction.jsx | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'webapp/components/post_view/reaction/reaction.jsx')

diff --git a/webapp/components/post_view/reaction/reaction.jsx b/webapp/components/post_view/reaction/reaction.jsx
index 5b65e604f..7fad56d62 100644
--- a/webapp/components/post_view/reaction/reaction.jsx
+++ b/webapp/components/post_view/reaction/reaction.jsx
@@ -41,6 +41,11 @@ export default class Reaction extends React.PureComponent {
          */
         otherUsersCount: PropTypes.number.isRequired,
 
+        /*
+         * Array of reactions by user
+         */
+        reactions: PropTypes.arrayOf(PropTypes.object).isRequired,
+
         /*
          * The URL of the emoji image
          */
@@ -82,6 +87,11 @@ export default class Reaction extends React.PureComponent {
         this.props.actions.removeReaction(this.props.post.id, this.props.emojiName);
     }
 
+    loadMissingProfiles = () => {
+        const ids = this.props.reactions.map((reaction) => reaction.user_id);
+        this.props.actions.getMissingProfilesByIds(ids);
+    }
+
     render() {
         let currentUserReacted = false;
         const users = [];
@@ -219,7 +229,7 @@ export default class Reaction extends React.PureComponent {
                         {clickTooltip}
                     </Tooltip>
                 }
-                onEnter={this.props.actions.getMissingProfilesByIds}
+                onEnter={this.loadMissingProfiles}
             >
                 <div
                     className={className}
-- 
cgit v1.2.3-1-g7c22

