Skip to content

Commit

Permalink
chore: Add docs & todo on EventTimelineItem::from_latest_event
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Jul 31, 2024
1 parent dc1a34c commit de502f4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/matrix-sdk-ui/src/timeline/event_item/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,20 @@ impl EventTimelineItem {

/// If the supplied low-level `SyncTimelineEvent` is suitable for use as the
/// `latest_event` in a message preview, wrap it as an `EventTimelineItem`.
///
/// **Note:** Timeline items created via this constructor do **not** produce
/// the correct ShieldState when calling
/// [`get_shield`][EventTimelineItem::get_shield]. This is because they are
/// intended for display in the room list which a) is unlikely to show
/// shields and b) would incur a significant performance overhead.
pub async fn from_latest_event(
client: Client,
room_id: &RoomId,
latest_event: LatestEvent,
) -> Option<EventTimelineItem> {
// TODO: We shouldn't be returning an EventTimelineItem here because we're
// starting to diverge on what kind of data we need. The note above is a
// potential footgun which could one day turn into a security issue.
use super::traits::RoomDataProvider;

let SyncTimelineEvent { event: raw_sync_event, encryption_info, .. } =
Expand Down

0 comments on commit de502f4

Please sign in to comment.