Fix serializing zero notification count in never-read room case.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
f4ee8bc433
commit
432e6a2663
1 changed files with 12 additions and 2 deletions
|
|
@ -10,7 +10,7 @@ use futures::{
|
|||
pin_mut,
|
||||
};
|
||||
use ruma::{
|
||||
DeviceId, EventId, OwnedRoomId, OwnedUserId, RoomId, UserId,
|
||||
DeviceId, EventId, OwnedRoomId, OwnedUserId, RoomId, UInt, UserId,
|
||||
api::client::{
|
||||
filter::FilterDefinition,
|
||||
sync::sync_events::{
|
||||
|
|
@ -995,6 +995,13 @@ async fn load_joined_room(
|
|||
.flatten()
|
||||
.is_none_or(|last_count| last_count.gt(&since));
|
||||
|
||||
let send_notification_resets = last_notification_read
|
||||
.flatten()
|
||||
.is_some_and(|last_count| last_count.gt(&since));
|
||||
|
||||
let send_notification_count_filter =
|
||||
|count: &UInt| *count != uint!(0) || send_notification_resets;
|
||||
|
||||
let notification_count: OptionFuture<_> = send_notification_counts
|
||||
.then(|| {
|
||||
services
|
||||
|
|
@ -1169,7 +1176,10 @@ async fn load_joined_room(
|
|||
.map(Event::into_format)
|
||||
.collect(),
|
||||
},
|
||||
unread_notifications: UnreadNotificationsCount { highlight_count, notification_count },
|
||||
unread_notifications: UnreadNotificationsCount {
|
||||
highlight_count: highlight_count.filter(send_notification_count_filter),
|
||||
notification_count: notification_count.filter(send_notification_count_filter),
|
||||
},
|
||||
unread_thread_notifications: BTreeMap::new(),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue