Skip to content

feat(send_queue): Implement sending of MSC4274 galleries #4977

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Johennes
Copy link
Contributor

@Johennes Johennes commented Apr 25, 2025

This was broken out of #4838 and is a step towards implementing MSC4274.

  • A new method RoomSendQueue::send_gallery was added to handle the sending of galleries
  • A new variant DependentQueuedRequestKind::FinishGallery handels the sending of the final event
  • Room::make_attachment_event was renamed to make_message_event because it is now reused to create gallery events as well

This is relatively large, unfortunately, but including everything needed to actually send the event made it possible to also add a test for it. It would be nice if the amount of new code could be reduced but I'm struggling a bit to find ways to integrate galleries with the existing media uploads further.

  • Public API changes documented in changelogs (optional)

@Johennes Johennes force-pushed the johannes/msc4274-step2 branch from ba8aa4b to 0c3161b Compare April 25, 2025 06:46
Comment on lines +2325 to +2334
let info = assign!(info.map(ImageInfo::from).unwrap_or_default(), {
mimetype: Some(content_type.as_ref().to_owned()),
thumbnail_source,
thumbnail_info
});
let content = assign!(ImageMessageEventContent::new(body, source), {
info: Some(Box::new(info)),
formatted: formatted_caption,
filename
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These blocks could maybe share the logic with make_attachment_type by extracting a function to create the content for each mime-type? I wasn't sure if it's really worth it because it might not be shorter due to the number of arguments on the call.

Copy link

codecov bot commented Apr 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.94%. Comparing base (8c3f554) to head (0c3161b).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4977      +/-   ##
==========================================
+ Coverage   85.91%   85.94%   +0.02%     
==========================================
  Files         325      325              
  Lines       35697    35699       +2     
==========================================
+ Hits        30670    30681      +11     
+ Misses       5027     5018       -9     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Johennes Johennes marked this pull request as ready for review April 25, 2025 07:16
@Johennes Johennes requested a review from a team as a code owner April 25, 2025 07:16
@Johennes Johennes requested review from poljar and removed request for a team April 25, 2025 07:16
@bnjbvr bnjbvr requested review from bnjbvr and removed request for poljar May 12, 2025 11:38
@Johennes
Copy link
Contributor Author

I'm mindful that it's probably just a matter of lack of time but if there's anything I can do to simplify reviewing this PR, I'd be happy to follow any suggestions.

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.

1 participant