summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorReed Garmsen <rgarmsen2295@gmail.com>2015-07-10 18:41:42 -0700
committerReed Garmsen <rgarmsen2295@gmail.com>2015-07-13 13:16:45 -0700
commitf406beca8b501dad508d1ffb900bf994c4192086 (patch)
tree2f3d64272c717a3c6ae347ebde78df507f18b334 /web
parente38ea318a1287710313a0c86fecb76dff8a923aa (diff)
downloadchat-f406beca8b501dad508d1ffb900bf994c4192086.tar.gz
chat-f406beca8b501dad508d1ffb900bf994c4192086.tar.bz2
chat-f406beca8b501dad508d1ffb900bf994c4192086.zip
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)
Diffstat (limited to 'web')
-rw-r--r--web/react/components/sidebar.jsx18
1 files changed, 17 insertions, 1 deletions
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();
}