1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-12-28 07:54:29 +01:00

fix: only show notifications for messages

This commit is contained in:
timokoesters 2020-05-31 19:40:01 +02:00
parent 3aa0c8ed25
commit b519bc6962
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4

View file

@ -2003,7 +2003,14 @@ pub fn sync_route(
let notification_count = let notification_count =
if let Some(last_read) = db.rooms.edus.room_read_get(&room_id, &user_id).unwrap() { if let Some(last_read) = db.rooms.edus.room_read_get(&room_id, &user_id).unwrap() {
Some((db.rooms.pdus_since(&room_id, last_read).unwrap().count() as u32).into()) Some(
(db.rooms
.pdus_since(&room_id, last_read)
.unwrap()
.filter(|pdu| matches!(pdu.as_ref().unwrap().kind.clone(), EventType::RoomMessage | EventType::RoomEncrypted))
.count() as u32)
.into(),
)
} else { } else {
None None
}; };
@ -2079,7 +2086,7 @@ pub fn sync_route(
}, },
}, },
unread_notifications: sync_events::UnreadNotificationsCount { unread_notifications: sync_events::UnreadNotificationsCount {
highlight_count: notification_count, highlight_count: None,
notification_count, notification_count,
}, },
timeline: sync_events::Timeline { timeline: sync_events::Timeline {