Skip to content

Commit f00ada6

Browse files
committed
sdk-ui: Add EncryptionState to Flow::Remote
1 parent 43ec6e4 commit f00ada6

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ impl TimelineStateTransaction<'_> {
584584
flow: Flow::Remote {
585585
event_id: event_id.clone(),
586586
raw_event: raw.clone(),
587-
encryption_info: event.encryption_state.as_encryption_info().cloned(),
587+
encryption_state: event.encryption_state.clone(),
588588
txn_id,
589589
position,
590590
},

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ use as_variant::as_variant;
1818
use eyeball_im::{ObservableVectorTransaction, ObservableVectorTransactionEntry};
1919
use indexmap::IndexMap;
2020
use matrix_sdk::{
21-
crypto::types::events::UtdCause, deserialized_responses::EncryptionInfo, send_queue::SendHandle,
21+
crypto::types::events::UtdCause,
22+
deserialized_responses::EncryptionState,
23+
send_queue::SendHandle,
2224
};
2325
use ruma::{
2426
events::{
@@ -95,7 +97,7 @@ pub(super) enum Flow {
9597
/// Where should this be added in the timeline.
9698
position: TimelineItemPosition,
9799
/// Information about the encryption for this event.
98-
encryption_info: Option<EncryptionInfo>,
100+
encryption_state: EncryptionState,
99101
},
100102
}
101103

@@ -596,9 +598,9 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
596598
let mut new_item = item.with_content(new_content, edit_json);
597599

598600
if let EventTimelineItemKind::Remote(remote_event) = &item.kind {
599-
if let Flow::Remote { encryption_info, .. } = &self.ctx.flow {
601+
if let Flow::Remote { encryption_state, .. } = &self.ctx.flow {
600602
new_item = new_item.with_kind(EventTimelineItemKind::Remote(
601-
remote_event.with_encryption_info(encryption_info.clone()),
603+
remote_event.with_encryption_info(encryption_state.as_encryption_info().cloned())
602604
));
603605
}
604606
}
@@ -927,7 +929,7 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
927929
}
928930
.into(),
929931

930-
Flow::Remote { event_id, raw_event, position, txn_id, encryption_info, .. } => {
932+
Flow::Remote { event_id, raw_event, position, txn_id, encryption_state, .. } => {
931933
let origin = match *position {
932934
TimelineItemPosition::Start { origin }
933935
| TimelineItemPosition::End { origin } => origin,
@@ -948,7 +950,7 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
948950
read_receipts: self.ctx.read_receipts.clone(),
949951
is_own: self.ctx.is_own_event,
950952
is_highlighted: self.ctx.is_highlighted,
951-
encryption_info: encryption_info.clone(),
953+
encryption_info: encryption_state.as_encryption_info().cloned(),
952954
original_json: Some(raw_event.clone()),
953955
latest_edit_json: None,
954956
origin,

0 commit comments

Comments
 (0)