mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-10 08:53:00 -04:00
refactor(timeline): use TimelineEventKind::AddItem for call invite/notify/sticker
This commit is contained in:
@@ -284,6 +284,24 @@ impl TimelineEventKind {
|
||||
kind: HandleAggregationKind::PollEnd,
|
||||
},
|
||||
|
||||
AnyMessageLikeEventContent::CallInvite(_) => {
|
||||
Self::add_item(TimelineItemContent::CallInvite)
|
||||
}
|
||||
|
||||
AnyMessageLikeEventContent::CallNotify(_) => {
|
||||
Self::add_item(TimelineItemContent::CallNotify)
|
||||
}
|
||||
|
||||
AnyMessageLikeEventContent::Sticker(content) => {
|
||||
Self::add_item(TimelineItemContent::MsgLike(MsgLikeContent {
|
||||
kind: MsgLikeKind::Sticker(Sticker { content }),
|
||||
reactions: Default::default(),
|
||||
thread_root: None,
|
||||
in_reply_to: None,
|
||||
thread_summary: None,
|
||||
}))
|
||||
}
|
||||
|
||||
_ => {
|
||||
// Default path: TODO remove
|
||||
Self::Message { content, relations: ev.relations() }
|
||||
@@ -502,21 +520,6 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
|
||||
}
|
||||
}
|
||||
|
||||
AnyMessageLikeEventContent::Sticker(content) => {
|
||||
if should_add {
|
||||
self.add_item(
|
||||
TimelineItemContent::MsgLike(MsgLikeContent {
|
||||
kind: MsgLikeKind::Sticker(Sticker { content }),
|
||||
reactions: Default::default(),
|
||||
thread_root: None,
|
||||
in_reply_to: None,
|
||||
thread_summary: None,
|
||||
}),
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
AnyMessageLikeEventContent::UnstablePollStart(
|
||||
UnstablePollStartEventContent::New(c),
|
||||
) => {
|
||||
@@ -525,18 +528,6 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
|
||||
}
|
||||
}
|
||||
|
||||
AnyMessageLikeEventContent::CallInvite(_) => {
|
||||
if should_add {
|
||||
self.add_item(TimelineItemContent::CallInvite, None);
|
||||
}
|
||||
}
|
||||
|
||||
AnyMessageLikeEventContent::CallNotify(_) => {
|
||||
if should_add {
|
||||
self.add_item(TimelineItemContent::CallNotify, None)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
_ => {
|
||||
debug!(
|
||||
|
||||
Reference in New Issue
Block a user