Skip to content

Commit 7de4ff0

Browse files
committed
Fixed live messaging notifications
1 parent ab8d985 commit 7de4ff0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/notifications.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ pub async fn register_notifications(
4646
settings: &ApplicationSettings,
4747
store: &AsyncProgramStore,
4848
) {
49+
tracing::info!("Registering notifications, enabled: {}", settings.tunables.notifications.enabled);
4950
if !settings.tunables.notifications.enabled {
51+
tracing::info!("Notifications disabled, skipping registration");
5052
return;
5153
}
5254
let notify_via = settings.tunables.notifications.via;
@@ -58,6 +60,7 @@ pub async fn register_notifications(
5860
};
5961

6062
let store = store.clone();
63+
tracing::info!("About to register notification handler");
6164
client
6265
.register_notification_handler(move |notification, room: MatrixRoom, client: Client| {
6366
let store = store.clone();
@@ -77,7 +80,22 @@ pub async fn register_notifications(
7780
match notification.event {
7881
RawAnySyncOrStrippedTimelineEvent::Sync(e) => {
7982
// Skip notifications for live messages
80-
if crate::message::live_detection::has_live_marker_in_raw(&e) {
83+
let json_str = e.json().get();
84+
let has_live_marker = crate::message::live_detection::has_live_marker_in_raw(&e);
85+
86+
// Extra debug logging
87+
if json_str.contains("org.matrix.msc4357.live") {
88+
tracing::info!("Found live marker string in notification event: {}",
89+
if has_live_marker { "DETECTED" } else { "NOT DETECTED by function" });
90+
if !has_live_marker {
91+
// Log first 500 chars of the event to see structure
92+
let preview = if json_str.len() > 500 { &json_str[..500] } else { &json_str };
93+
tracing::warn!("Live marker in string but not detected by function. Event preview: {}", preview);
94+
}
95+
}
96+
97+
if has_live_marker {
98+
tracing::info!("Skipping notification for live message in room {}", room_id);
8199
return;
82100
}
83101

0 commit comments

Comments
 (0)