Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(timeline): update responses after a UTD has been decrypted #4210

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Nov 4, 2024

Fixes #4196.

@bnjbvr bnjbvr requested a review from a team as a code owner November 4, 2024 14:59
@bnjbvr bnjbvr requested review from poljar and removed request for a team November 4, 2024 14:59
Comment on lines +100 to +104

let first_item_again =
assert_next_matches!(stream, VectorDiff::Set { index: 0, value } => value);
assert_matches!(first_item_again.content(), TimelineItemContent::RedactedMessage);
assert_matches!(first_item_again.original_json(), None);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of the assertion is changed here, because now we update the responses before the original event. This avoids a copy in the timeline code 👀 . You would be right calling this a code smell and asking for a change here, as I didn't bother too much (observers wouldn't notice a big difference).

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 76.92308% with 6 lines in your changes missing coverage. Please review.

Project coverage is 84.90%. Comparing base (5d141fc) to head (2665ea3).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk-ui/src/timeline/event_handler.rs 76.92% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4210      +/-   ##
==========================================
+ Coverage   84.88%   84.90%   +0.02%     
==========================================
  Files         272      272              
  Lines       29133    29125       -8     
==========================================
  Hits        24730    24730              
+ Misses       4403     4395       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was confused for a bit longer than I'd like to admit, but I think that this looks good.

@@ -1190,8 +1190,34 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
}
}

Flow::Remote { position: TimelineItemPosition::Update(idx), .. } => {
Flow::Remote {
event_id: decrypted_event_id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really part of this PR but, oh boy, I feel like this could express that this is an UTD -> Decrypted transition a bit better.

Flow::Remote is generally for remote echoes and TimlineItemPosition::Update does not sound UTD specific at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to rename this Update; will do in a follow-up, thanks!

@bnjbvr bnjbvr force-pushed the bnjbvr/update-response-after-successful-decryption branch from f8b231a to 2665ea3 Compare November 4, 2024 16:36
@bnjbvr bnjbvr enabled auto-merge (rebase) November 4, 2024 16:36
@bnjbvr bnjbvr merged commit 90d6a37 into main Nov 4, 2024
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/update-response-after-successful-decryption branch November 4, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

replied-to UTD messages are not updated when the key is received
2 participants