Skip to content

Commit abda959

Browse files
authored
chore(ui): Make TimelineInnerMetadata::next_internal_id private
chore(ui): Make `TimelineInnerMetadata::next_internal_id` private
2 parents 1a343d9 + 2a70587 commit abda959

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,17 +1005,15 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
10051005
// pending local echo, or at the start if there is no such item.
10061006
let insert_idx = latest_event_idx.map_or(0, |idx| idx + 1);
10071007

1008-
let id = match removed_event_item_id {
1008+
trace!("Adding new remote timeline item after all non-pending events");
1009+
let new_item = match removed_event_item_id {
10091010
// If a previous version of the same item (usually a local
10101011
// echo) was removed and we now need to add it again, reuse
10111012
// the previous item's ID.
1012-
Some(id) => id,
1013-
None => self.meta.next_internal_id(),
1013+
Some(id) => TimelineItem::new(item, id),
1014+
None => self.meta.new_timeline_item(item),
10141015
};
10151016

1016-
trace!("Adding new remote timeline item after all non-pending events");
1017-
let new_item = TimelineItem::new(item, id);
1018-
10191017
// Keep push semantics, if we're inserting at the front or the back.
10201018
if insert_idx == self.items.len() {
10211019
self.items.push_back(new_item);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ impl TimelineInnerMetadata {
788788

789789
/// Returns the next internal id for a timeline item (and increment our
790790
/// internal counter).
791-
pub fn next_internal_id(&mut self) -> String {
791+
fn next_internal_id(&mut self) -> String {
792792
let val = self.next_internal_id;
793793
self.next_internal_id += 1;
794794
let prefix = self.internal_id_prefix.as_deref().unwrap_or("");

0 commit comments

Comments
 (0)