Skip to content

Commit 248d77a

Browse files
committed
refactor(ffi): add debug logging when a latest event is not a standalone content item
1 parent f4451b5 commit 248d77a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

crates/matrix-sdk-ui/src/timeline/event_handler.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@ pub(super) enum HandleAggregationKind {
145145
PollEnd,
146146
}
147147

148+
impl HandleAggregationKind {
149+
/// Returns a small string describing this aggregation, for debug purposes.
150+
pub fn debug_string(&self) -> &'static str {
151+
match self {
152+
HandleAggregationKind::Reaction { .. } => "a reaction",
153+
HandleAggregationKind::Redaction => "a redaction",
154+
HandleAggregationKind::Edit { .. } => "an edit",
155+
HandleAggregationKind::PollResponse { .. } => "a poll response",
156+
HandleAggregationKind::PollEdit { .. } => "a poll edit",
157+
HandleAggregationKind::PollEnd => "a poll end",
158+
}
159+
}
160+
}
161+
148162
/// An action that we want to cause on the timeline.
149163
#[derive(Clone, Debug)]
150164
#[allow(clippy::large_enum_variant)]

crates/matrix-sdk-ui/src/timeline/latest_event.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use matrix_sdk::{Client, Room, latest_events::LocalLatestEventValue};
1616
use matrix_sdk_base::latest_event::LatestEventValue as BaseLatestEventValue;
1717
use ruma::{MilliSecondsSinceUnixEpoch, OwnedUserId};
18+
use tracing::trace;
1819

1920
use crate::timeline::{
2021
Profile, TimelineDetails, TimelineItemContent, event_handler::TimelineAction,
@@ -121,6 +122,9 @@ impl LatestEventValue {
121122
}
122123

123124
TimelineAction::HandleAggregation { kind, .. } => {
125+
// Add some debug logging here to help diagnose issues with the latest
126+
// event.
127+
trace!("latest event is an aggregation: {}", kind.debug_string());
124128
Self::None
125129
}
126130
}

0 commit comments

Comments
 (0)