Skip to content

Commit b233aa6

Browse files
committed
chore(timeline): rename TimelineItemPosition::Update to UpdateDecrypted
1 parent ace96e3 commit b233aa6

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

crates/matrix-sdk-ui/src/timeline/controller/state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl TimelineState {
241241
let handle_one_res = txn
242242
.handle_remote_event(
243243
event.into(),
244-
TimelineItemPosition::Update(idx),
244+
TimelineItemPosition::UpdateDecrypted(idx),
245245
room_data_provider,
246246
settings,
247247
&mut day_divider_adjuster,
@@ -447,7 +447,7 @@ impl TimelineStateTransaction<'_> {
447447
TimelineItemPosition::End { origin }
448448
| TimelineItemPosition::Start { origin } => origin,
449449

450-
TimelineItemPosition::Update(idx) => self
450+
TimelineItemPosition::UpdateDecrypted(idx) => self
451451
.items
452452
.get(idx)
453453
.and_then(|item| item.as_event())
@@ -703,7 +703,7 @@ impl TimelineStateTransaction<'_> {
703703
self.meta.all_events.push_back(event_meta.base_meta());
704704
}
705705

706-
TimelineItemPosition::Update(_) => {
706+
TimelineItemPosition::UpdateDecrypted(_) => {
707707
if let Some(event) =
708708
self.meta.all_events.iter_mut().find(|e| e.event_id == event_meta.event_id)
709709
{

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,11 @@ pub(super) enum TimelineItemPosition {
275275
/// recent).
276276
End { origin: RemoteEventOrigin },
277277

278-
/// A single item is updated.
278+
/// A single item is updated, after it's been successfully decrypted.
279279
///
280-
/// This only happens when a UTD must be replaced with the decrypted event.
281-
Update(usize),
280+
/// This happens when an item that was a UTD must be replaced with the
281+
/// decrypted event.
282+
UpdateDecrypted(usize),
282283
}
283284

284285
/// The outcome of handling a single event with
@@ -480,7 +481,8 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
480481
if !self.result.item_added {
481482
trace!("No new item added");
482483

483-
if let Flow::Remote { position: TimelineItemPosition::Update(idx), .. } = self.ctx.flow
484+
if let Flow::Remote { position: TimelineItemPosition::UpdateDecrypted(idx), .. } =
485+
self.ctx.flow
484486
{
485487
// If add was not called, that means the UTD event is one that
486488
// wouldn't normally be visible. Remove it.
@@ -574,7 +576,7 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
574576
replacement: PendingEdit,
575577
) {
576578
match position {
577-
TimelineItemPosition::Start { .. } | TimelineItemPosition::Update(_) => {
579+
TimelineItemPosition::Start { .. } | TimelineItemPosition::UpdateDecrypted(_) => {
578580
// Only insert the edit if there wasn't any other edit
579581
// before.
580582
//
@@ -1010,7 +1012,7 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
10101012
| TimelineItemPosition::End { origin } => origin,
10111013

10121014
// For updates, reuse the origin of the encrypted event.
1013-
TimelineItemPosition::Update(idx) => self.items[idx]
1015+
TimelineItemPosition::UpdateDecrypted(idx) => self.items[idx]
10141016
.as_event()
10151017
.and_then(|ev| Some(ev.as_remote()?.origin))
10161018
.unwrap_or_else(|| {
@@ -1160,7 +1162,7 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
11601162

11611163
Flow::Remote {
11621164
event_id: decrypted_event_id,
1163-
position: TimelineItemPosition::Update(idx),
1165+
position: TimelineItemPosition::UpdateDecrypted(idx),
11641166
..
11651167
} => {
11661168
trace!("Updating timeline item at position {idx}");

0 commit comments

Comments
 (0)