From 0f3d62364b7efaa553c711f2a63852a09b34277c Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Fri, 1 Apr 2016 11:53:49 -0400
Subject: Properly display webhook username/icon in search results

---
 webapp/utils/utils.jsx | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'webapp/utils/utils.jsx')

diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 9b03ef32a..3b7583f15 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -1379,3 +1379,18 @@ export function localizeMessage(id, defaultMessage) {
 
     return id;
 }
+
+export function getProfilePicSrcForPost(post, timestamp) {
+    let src = '/api/v1/users/' + post.user_id + '/image?time=' + timestamp;
+    if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
+        if (post.props.override_icon_url) {
+            src = post.props.override_icon_url;
+        } else {
+            src = Constants.DEFAULT_WEBHOOK_LOGO;
+        }
+    } else if (isSystemMessage(post)) {
+        src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE;
+    }
+
+    return src;
+}
-- 
cgit v1.2.3-1-g7c22

