-
Notifications
You must be signed in to change notification settings - Fork 262
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(send_queue): Use MediaFormat::File
when caching attachment thumbnail
#4400
Conversation
The `MediaFormat` reflects only the request that would be made to the homeserver. There is no link between the format of the files stored in the media cache and their purpose in an event. `MediaFormat::Tumbnail` means that we request a server-generated thumbnail of a file in the media repository. Since the thumbnail is its own file in the media repository, it makes more sense to use `MediaFormat::File`. Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4400 +/- ##
==========================================
- Coverage 85.25% 85.22% -0.03%
==========================================
Files 282 282
Lines 31065 31064 -1
==========================================
- Hits 26483 26475 -8
- Misses 4582 4589 +7 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, nice serde trickery!
let from_req = | ||
Media::make_local_thumbnail_media_request(&info.txn, info.height, info.width); | ||
// Previously the media request used `MediaFormat::Thumbnail`. Handle this case | ||
// for send queue requests that were in the state store before the change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state store? or cache store?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about DependentQueuedRequestKind
, so the state store, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right 🤦
/// The attachment and its optional thumbnail are stored in the media cache | ||
/// and can be retrieved at any time, by calling | ||
/// [`Media::get_media_content()`] with the `MediaSource` that can be found | ||
/// in the local or remote echo, and using a `MediaFormat::File`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
Fix extracted from #4329.
The
MediaFormat
reflects only the request that would be made to the homeserver. There is no link between the format of the files stored in the media cache and their purpose in an event.MediaFormat::Thumbnail
means that we request a server-generated thumbnail of a file in the media repository. Since the thumbnail is its own file in the media repository, it makes more sense to useMediaFormat::File
. See #4329 (comment) for even more details why this change makes sense.The fix was simplified a lot here. Instead of requiring a migration, we just minimize the changes in the format of the send queue request in the state store and keep handling the previous case.
This also documents the caching of the media when calling
send_attachment
.