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

feat(send queue): allow editing media captions #4277

Merged
merged 6 commits into from
Nov 20, 2024
Merged

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Nov 18, 2024

This allows editing media captions:

  • for remote echo'd events, adding support in make_edit_event is sufficient,
  • for local events (that are in the send queue), a bit more work is necessary:
    • either the media event is a dependent request, and we need to update it
    • or the media event is a request, and we need to update it
    • or the media event is being sent, and we'll record a dependent request for an edit

Fixes #4201

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 77.31481% with 49 lines in your changes missing coverage. Please review.

Project coverage is 84.97%. Comparing base (21bb85a) to head (ddacf1b).
Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/room/edit.rs 61.11% 28 Missing ⚠️
crates/matrix-sdk-ui/src/timeline/mod.rs 0.00% 6 Missing ⚠️
crates/matrix-sdk/src/send_queue/upload.rs 88.23% 6 Missing ⚠️
crates/matrix-sdk/src/send_queue.rs 82.35% 3 Missing ⚠️
crates/matrix-sdk/src/test_utils/events.rs 80.00% 3 Missing ⚠️
crates/matrix-sdk-base/src/store/memory_store.rs 85.71% 1 Missing ⚠️
crates/matrix-sdk-base/src/store/traits.rs 80.00% 1 Missing ⚠️
crates/matrix-sdk-sqlite/src/state_store.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4277      +/-   ##
==========================================
- Coverage   85.04%   84.97%   -0.07%     
==========================================
  Files         274      274              
  Lines       30043    30230     +187     
==========================================
+ Hits        25550    25689     +139     
- Misses       4493     4541      +48     

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


🚨 Try these New Features:

@bnjbvr bnjbvr force-pushed the bnjbvr/edit-captions branch from 017431e to f070236 Compare November 18, 2024 15:27
@bnjbvr bnjbvr marked this pull request as ready for review November 18, 2024 15:28
@bnjbvr bnjbvr requested a review from a team as a code owner November 18, 2024 15:28
@bnjbvr bnjbvr requested review from stefanceriu and removed request for a team November 18, 2024 15:29
…t yet

test(timeline): add an integration test for sending an attachment

test(timeline): add tests for multiple caption edits and local reaction to a media upload
@bnjbvr bnjbvr force-pushed the bnjbvr/edit-captions branch from d16775c to ddacf1b Compare November 19, 2024 14:55
@bnjbvr bnjbvr requested a review from stefanceriu November 19, 2024 14:56
Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

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

Apart from those small comments this is all really nice and makes perfect sense to me ... and the tests are just chef's kiss 👌

let event_id = event_id!("$1");
let own_user_id = user_id!("@me:saucisse.bzh");

let filename = "rickroll.gif";
Copy link
Member

Choose a reason for hiding this comment

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

🕺

Comment on lines +619 to +621
let QueuedRequestKind::Event { content: serialized_content } = found.kind else {
return Err(InvalidMediaCaptionEdit);
};
Copy link
Member

Choose a reason for hiding this comment

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

Just for my understanding: finding a non-event kind here is a developer error and the wrong txn was passed in, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, all these errors would either be caused by a wrong txn_id, or a super inconsistent internal state 👍

@bnjbvr bnjbvr merged commit 60893d2 into main Nov 20, 2024
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/edit-captions branch November 20, 2024 09:11
bnjbvr pushed a commit that referenced this pull request Nov 21, 2024
This PR makes audio, file, image and video messages be editable so that
the timeline signals when it is possible to use #4277/#4300 for editing
captions.
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.

send queue: allow editing/aborting/unwedging a media upload
2 participants