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

send queue: allow editing local echoes #3616

Merged
merged 8 commits into from
Jun 27, 2024
Merged

send queue: allow editing local echoes #3616

merged 8 commits into from
Jun 27, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Jun 26, 2024

Final step of #3361, as a bonus.

Fixes #3361.

@bnjbvr bnjbvr requested a review from a team as a code owner June 26, 2024 19:23
@bnjbvr bnjbvr requested review from andybalaam and removed request for a team June 26, 2024 19:23
@bnjbvr bnjbvr force-pushed the bnjbvr/send-handle branch from 248e23a to df636eb Compare June 26, 2024 19:25
Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 84.03361% with 19 lines in your changes missing coverage. Please review.

Project coverage is 84.20%. Comparing base (8e8d793) to head (0155ddf).
Report is 11 commits behind head on main.

Files Patch % Lines
crates/matrix-sdk-ui/src/timeline/inner/mod.rs 60.86% 9 Missing ⚠️
crates/matrix-sdk-ui/src/timeline/builder.rs 60.00% 4 Missing ⚠️
crates/matrix-sdk-ui/src/timeline/mod.rs 76.47% 4 Missing ⚠️
crates/matrix-sdk-ui/src/timeline/event_handler.rs 50.00% 1 Missing ⚠️
...rates/matrix-sdk-ui/src/timeline/event_item/mod.rs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3616      +/-   ##
==========================================
+ Coverage   84.18%   84.20%   +0.02%     
==========================================
  Files         255      255              
  Lines       26391    26490      +99     
==========================================
+ Hits        22217    22306      +89     
- Misses       4174     4184      +10     

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

@bnjbvr bnjbvr force-pushed the bnjbvr/send-handle branch from a4a4d02 to d2255f0 Compare June 27, 2024 08:21
@Hywan Hywan requested review from Hywan and removed request for andybalaam June 27, 2024 10:57
Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

It looks generally good to me. The fact the patches modify both the SendQueue, the database, and the Timeline make it a bit difficult to follow, but thanks to your atomic commits, it wasn't that much complicated.

Please rebase your fixup! patches before merging your PR.

crates/matrix-sdk/src/send_queue.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/send_queue.rs Show resolved Hide resolved
let AnyMessageLikeEventContent::RoomMessage(content) = content else {
// Ideally, we'd support replacing local echoes for a reaction, etc., but
// handling RoomMessage should be sufficient in most cases. Worst
// case, the local echo will be sent Soon™ and we'll get another chance at
Copy link
Member

Choose a reason for hiding this comment

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

“Soon™” 😄

By the way, I agree with this. It means someone reacts to its own local event, and wants to change that. That's clearly an edge case.

new_content: Arc<RoomMessageEventContentWithoutRelation>,
) -> Result<bool, ClientError> {
let edit_info = item.0.edit_info().map_err(|err| anyhow::anyhow!(err))?;
Copy link
Member

Choose a reason for hiding this comment

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

ClientError::from(err) doesn't work (to replace anyhow!)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, with a new conversion method. I'll add it. We should do a pass at making better errors at the FFI layer some day.

bnjbvr added 7 commits June 27, 2024 18:17
The first parameter doesn't need to be taken by ownership, reference is
sufficient.
It also resets the wedged state, so that the queue will retry to send
this event later. This will show useful in the following case: when an
event is too big, we can now retry to send it, even if it was blocked,
by splitting the event instead of copy/abort/recreate it.
@bnjbvr bnjbvr force-pushed the bnjbvr/send-handle branch from c0919b5 to a3ae048 Compare June 27, 2024 16:23
@bnjbvr bnjbvr force-pushed the bnjbvr/send-handle branch from a3ae048 to 0155ddf Compare June 27, 2024 16:37
@bnjbvr bnjbvr enabled auto-merge (rebase) June 27, 2024 16:39
@bnjbvr bnjbvr merged commit 1c92633 into main Jun 27, 2024
38 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/send-handle branch June 27, 2024 16:53
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.

timeline: introduce a Send Queue API
2 participants