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: Extract `notification_source` debugging logic.

Daniil Fadeevfdac13ba24db
diff --git a/web/src/notifications.js b/web/src/notifications.js
index b7c5940e4a2..6e118dc93ae 100644
--- a/web/src/notifications.js
+++ b/web/src/notifications.js
@@ -229,6 +229,22 @@ function get_notification_content(message) {
return content;
}
+function debug_notification_source_value(message) {
+ let notification_source;
+
+ if (message.type === "private" || message.type === "test-notification") {
+ notification_source = "pm";
+ } else if (message.mentioned) {
+ notification_source = "mention";
+ } else if (message.alerted) {
+ notification_source = "alert";
+ } else {
+ notification_source = "stream";
+ }
+
+ blueslip.debug("Desktop notification from source " + notification_source);
+}
+
export function process_notification(notification) {
let notification_object;
let key;
@@ -237,29 +253,21 @@ export function process_notification(notification) {
let other_recipients;
let title = message.sender_full_name;
let msg_count = 1;
- let notification_source;
const topic = message.topic;
+ debug_notification_source_value(message);
+
if (message.type === "private" || message.type === "test-notification") {
key = message.display_reply_to;
// Remove the sender from the list of other recipients
other_recipients = `, ${message.display_reply_to}, `
.replace(`, ${message.sender_full_name}, `, ", ")
.slice(", ".length, -", ".length);
- notification_source = "pm";
} else {
const stream_name = stream_data.get_stream_name_from_id(message.stream_id);
key = message.sender_full_name + " to " + stream_name + " > " + topic;
- if (message.mentioned) {
- notification_source = "mention";
- } else if (message.alerted) {
- notification_source = "alert";
- } else {
- notification_source = "stream";
- }
}
- blueslip.debug("Desktop notification from source " + notification_source);
if (notice_memory.has(key)) {
msg_count = notice_memory.get(key).msg_count + 1;