From f406beca8b501dad508d1ffb900bf994c4192086 Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Fri, 10 Jul 2015 18:41:42 -0700
Subject: If a message has no text but has an attached image or file the
 desktop notification now says uploaded an image or uploaded a file
 respectively (if both, defaults to image)

---
 web/react/components/sidebar.jsx | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 934a4d22a..cae9425d3 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -249,11 +249,27 @@ var SidebarLoggedIn = React.createClass({
 
                 var repRegex = new RegExp("<br>", "g");
                 var post = JSON.parse(msg.props.post);
+                var msgProps = msg.props;
                 var msg = post.message.replace(repRegex, "\n").replace(/\n+/g, " ").replace("<mention>", "").replace("</mention>", "");
+                
                 if (msg.length > 50) {
                     msg = msg.substring(0,49) + "...";
                 }
-                utils.notifyMe(title, username + " wrote: " + msg, channel);
+
+                if (msg.length === 0) {
+                    if (msgProps.image) {
+                        utils.notifyMe(title, username + " uploaded an image", channel);
+                    }
+                    else if (msgProps.otherFile) {
+                        utils.notifyMe(title, username + " uploaded a file", channel);
+                    }
+                    else {
+                        utils.notifyMe(title, username + " did something new", channel);
+                    }
+                }
+                else {
+                    utils.notifyMe(title, username + " wrote: " + msg, channel);
+                }
                 if (!user.notify_props || user.notify_props.desktop_sound === "true") {
                     utils.ding();
                 }
-- 
cgit v1.2.3-1-g7c22

