Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
notifications: Extract notification title retrieval.
Daniil Fadeev0a11a4b9830d
diff --git a/web/src/notifications.js b/web/src/notifications.jsindex 061589aa198..50038d81856 100644--- a/web/src/notifications.js+++ b/web/src/notifications.js@@ -264,22 +264,12 @@ function remove_sender_from_list_of_recipients(message) {.slice(", ".length, -", ".length);}-export function process_notification(notification) {- const message = notification.message;- const content = get_notification_content(message);- const key = get_notification_key(message);- let notification_object;- let other_recipients;+function get_notification_title(message, content, msg_count) {let title = message.sender_full_name;- let msg_count = 1;-- debug_notification_source_value(message);+ let other_recipients;- if (notice_memory.has(key)) {- msg_count = notice_memory.get(key).msg_count + 1;+ if (msg_count > 1) {title = msg_count + " messages from " + title;- notification_object = notice_memory.get(key).obj;- notification_object.close();}switch (message.type) {@@ -309,6 +299,26 @@ export function process_notification(notification) {}}+ return title;+}++export function process_notification(notification) {+ const message = notification.message;+ const content = get_notification_content(message);+ const key = get_notification_key(message);+ let notification_object;+ let msg_count = 1;++ debug_notification_source_value(message);++ if (notice_memory.has(key)) {+ msg_count = notice_memory.get(key).msg_count + 1;+ notification_object = notice_memory.get(key).obj;+ notification_object.close();+ }++ const title = get_notification_title(message, content, msg_count);+if (notification.desktop_notify) {const icon_url = people.small_avatar_url(message);notification_object = new NotificationAPI(title, {