Browse Source

room: Remove trace-level logs to debug unread status

fractal-9
Kévin Commaille 2 years ago
parent
commit
1f19619df0
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 9
      src/session/model/room/mod.rs
  2. 26
      src/session/model/room/timeline/mod.rs

9
src/session/model/room/mod.rs

@ -1254,11 +1254,9 @@ impl Room {
/// Set how this room is highlighted.
fn set_highlight(&self, highlight: HighlightFlags) {
tracing::trace!("{}::set_highlight: {highlight:?}", self.human_readable_id());
if self.highlight() == highlight {
return;
}
tracing::trace!("{}: highlight changed", self.human_readable_id());
self.imp().highlight.set(highlight);
self.notify_highlight();
@ -1266,7 +1264,6 @@ impl Room {
/// Handle the trigger emitted when a read change might have occurred.
async fn handle_read_change_trigger(&self) {
tracing::trace!("{}::handle_read_change_trigger", self.human_readable_id());
if let Some(has_unread) = self.timeline().has_unread_messages().await {
self.set_is_read(!has_unread);
}
@ -1276,12 +1273,10 @@ impl Room {
/// Set whether all messages of this room are read.
fn set_is_read(&self, is_read: bool) {
tracing::trace!("{}::set_is_read: {is_read:?}", self.human_readable_id());
if is_read == self.is_read() {
return;
}
tracing::trace!("{}: is_read changed", self.human_readable_id());
self.imp().is_read.set(is_read);
self.notify_is_read();
}
@ -1291,10 +1286,6 @@ impl Room {
let Some(session) = self.session() else {
return;
};
tracing::trace!(
"{}::send_receipt: {receipt_type:?} at {position:?}",
self.human_readable_id()
);
let send_public_receipt = session.settings().public_read_receipts_enabled();
let receipt_type = match receipt_type {

26
src/session/model/room/timeline/mod.rs

@ -793,24 +793,14 @@ impl Timeline {
let own_user_id = session.user_id().clone();
let matrix_timeline = self.matrix_timeline();
let (actual_receipt_event_id, user_receipt_item) = spawn_tokio!(async move {
let actual_receipt_event_id = matrix_timeline
.latest_user_read_receipt(&own_user_id)
.await
.map(|(event_id, _)| event_id);
let user_receipt_item = matrix_timeline
let user_receipt_item = spawn_tokio!(async move {
matrix_timeline
.latest_user_read_receipt_timeline_event_id(&own_user_id)
.await;
(actual_receipt_event_id, user_receipt_item)
.await
})
.await
.unwrap();
tracing::trace!(
"{}::has_unread_messages: Read receipt at actual event {actual_receipt_event_id:?}, visible at timeline event {user_receipt_item:?}",
room.human_readable_id(),
);
let sdk_items = &self.imp().sdk_items;
let count = sdk_items.n_items();
@ -821,20 +811,10 @@ impl Timeline {
if user_receipt_item.is_some() && event.event_id() == user_receipt_item {
// The event is the oldest one, we have read it all.
tracing::trace!(
"{}::has_unread_messages: Got event {:?} from read receipt",
room.human_readable_id(),
event.key()
);
return Some(false);
}
if event.counts_as_unread() {
// There is at least one unread event.
tracing::trace!(
"{}::has_unread_messages: Event {:?} is unread",
room.human_readable_id(),
event.key()
);
return Some(true);
}
}

Loading…
Cancel
Save