Skip to content

Commit d4071e2

Browse files
author
Evie Gauthier
committed
debug: add logging for encrypted notification content
Add debug logging to diagnose server-decrypted push notification handling: - Log push notification content structure in service worker - Log preview text resolution decisions and content keys - Helps identify if matrix_synapse_push_include_content is working correctly
1 parent d632c03 commit d4071e2

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/app/utils/notificationStyle.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ export const resolveNotificationPreviewText = ({
6565

6666
const encryptedContext = isEncryptedRoom || eventType === 'm.room.encrypted';
6767

68+
console.debug('[NotifPreview]', {
69+
eventType,
70+
isEncryptedRoom,
71+
hasBody: body !== undefined,
72+
bodyPreview: body?.substring(0, 20),
73+
encryptedContext,
74+
showMessageContent,
75+
showEncryptedMessageContent,
76+
contentKeys: content && typeof content === 'object' ? Object.keys(content) : [],
77+
});
78+
6879
if (!showMessageContent) {
6980
return encryptedContext ? ENCRYPTED_MESSAGE_PREVIEW : DEFAULT_MESSAGE_PREVIEW;
7081
}

src/sw/pushNotification.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ export const createPushNotifications = (
116116
timestamp: Date.now(),
117117
...pushData.data,
118118
};
119+
console.debug(
120+
'[SW Encrypted Notif] content:',
121+
JSON.stringify(pushData?.content, null, 2),
122+
'| type:',
123+
pushData?.type
124+
);
119125
const notificationPayload = buildRoomMessageNotification({
120126
roomName: pushData?.room_name,
121127
username: pushData?.sender_display_name,

0 commit comments

Comments
 (0)