Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

notifications: Fix blank notification sent when no text specified.

Lakshay Mittalf84de2212e41
diff --git a/web/src/notifications.js b/web/src/notifications.js
index fd22e0e4c7d..cfc5d010168 100644
--- a/web/src/notifications.js
+++ b/web/src/notifications.js
@@ -10,6 +10,7 @@ import * as favicon from "./favicon";
import * as hash_util from "./hash_util";
import {$t} from "./i18n";
import * as message_lists from "./message_lists";
+import * as message_parser from "./message_parser";
import * as message_store from "./message_store";
import * as narrow from "./narrow";
import * as narrow_state from "./narrow_state";
@@ -241,7 +242,16 @@ export function process_notification(notification) {
const $content = $("<div>").html(message.content);
ui.replace_emoji_with_text($content);
spoilers.hide_spoilers_in_notification($content);
- content = $content.text();
+
+ if (
+ $content.text().trim() === "" &&
+ (message_parser.message_has_image(message) ||
+ message_parser.message_has_attachment(message))
+ ) {
+ content = $t({defaultMessage: "(attached file)"});
+ } else {
+ content = $content.text();
+ }
const topic = message.topic;