summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-07-14 10:51:20 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-07-14 10:51:20 -0400
commit2e4b61ef3847a63ed14b02a5466add33de8c8cf9 (patch)
treecb712369087ab05c3adc41a6081b16a5e4e59eb3 /web
parent1ba12b0ccfe75c5beaeb10b5e64d334f005a735a (diff)
parentf406beca8b501dad508d1ffb900bf994c4192086 (diff)
downloadchat-2e4b61ef3847a63ed14b02a5466add33de8c8cf9.tar.gz
chat-2e4b61ef3847a63ed14b02a5466add33de8c8cf9.tar.bz2
chat-2e4b61ef3847a63ed14b02a5466add33de8c8cf9.zip
Merge pull request #167 from rgarmsen2295/mm-629
MM-629 Empty messages with files attached now include text in the desktop notification describing the contents
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();
}