@@ -103,6 +103,12 @@ pub enum QueuedRequestKind {
103103
104104 /// To which media event transaction does this upload relate?
105105 related_to : OwnedTransactionId ,
106+
107+ /// Accumulated list of infos for previously uploaded files and
108+ /// thumbnails if used during a gallery transaction. Otherwise empty.
109+ #[ cfg( feature = "unstable-msc4274" ) ]
110+ #[ serde( default ) ]
111+ accumulated : Vec < AccumulatedSentMediaInfo > ,
106112 } ,
107113}
108114
@@ -219,17 +225,23 @@ pub enum DependentQueuedRequestKind {
219225 key : String ,
220226 } ,
221227
222- /// Upload a file that had a thumbnail.
223- UploadFileWithThumbnail {
224- /// Content type for the file itself (not the thumbnail).
228+ /// Upload a file or thumbnail depending on another file or thumbnail
229+ /// upload.
230+ #[ serde( alias = "UploadFileWithThumbnail" ) ]
231+ UploadFileOrThumbnail {
232+ /// Content type for the file or thumbnail.
225233 content_type : String ,
226234
227- /// Media request necessary to retrieve the file itself (not the
228- /// thumbnail).
235+ /// Media request necessary to retrieve the file or thumbnail itself.
229236 cache_key : MediaRequestParameters ,
230237
231238 /// To which media transaction id does this upload relate to?
232239 related_to : OwnedTransactionId ,
240+
241+ /// Whether the depended upon request was a thumbnail or a file upload.
242+ #[ cfg( feature = "unstable-msc4274" ) ]
243+ #[ serde( default = "default_parent_is_thumbnail_upload" ) ]
244+ parent_is_thumbnail_upload : bool ,
233245 } ,
234246
235247 /// Finish an upload by updating references to the media cache and sending
@@ -248,6 +260,14 @@ pub enum DependentQueuedRequestKind {
248260 } ,
249261}
250262
263+ /// If parent_is_thumbnail_upload is missing, we assume the request is for a
264+ /// file upload following a thumbnail upload. This was the only possible case
265+ /// before parent_is_thumbnail_upload was introduced.
266+ #[ cfg( feature = "unstable-msc4274" ) ]
267+ fn default_parent_is_thumbnail_upload ( ) -> bool {
268+ true
269+ }
270+
251271/// Detailed record about a thumbnail used when finishing a media upload.
252272#[ derive( Clone , Debug , Serialize , Deserialize ) ]
253273pub struct FinishUploadThumbnailInfo {
@@ -310,7 +330,7 @@ impl From<OwnedTransactionId> for ChildTransactionId {
310330 }
311331}
312332
313- /// Information about a media (and its thumbnail) that have been sent to an
333+ /// Information about a media (and its thumbnail) that have been sent to a
314334/// homeserver.
315335#[ derive( Clone , Debug , Serialize , Deserialize ) ]
316336pub struct SentMediaInfo {
@@ -324,6 +344,29 @@ pub struct SentMediaInfo {
324344 ///
325345 /// When uploading a thumbnail, this is set to `None`.
326346 pub thumbnail : Option < MediaSource > ,
347+
348+ /// Accumulated list of infos for previously uploaded files and thumbnails
349+ /// if used during a gallery transaction. Otherwise empty.
350+ #[ cfg( feature = "unstable-msc4274" ) ]
351+ #[ serde( default ) ]
352+ pub accumulated : Vec < AccumulatedSentMediaInfo > ,
353+ }
354+
355+ /// Accumulated information about a media (and its thumbnail) that have been
356+ /// sent to a homeserver.
357+ #[ cfg( feature = "unstable-msc4274" ) ]
358+ #[ derive( Clone , Debug , Serialize , Deserialize ) ]
359+ pub struct AccumulatedSentMediaInfo {
360+ /// File that was uploaded by this request.
361+ ///
362+ /// If the request related to a thumbnail upload, this contains the
363+ /// thumbnail media source.
364+ pub file : MediaSource ,
365+
366+ /// Optional thumbnail previously uploaded, when uploading a file.
367+ ///
368+ /// When uploading a thumbnail, this is set to `None`.
369+ pub thumbnail : Option < MediaSource > ,
327370}
328371
329372/// A unique key (identifier) indicating that a transaction has been
@@ -390,7 +433,7 @@ impl DependentQueuedRequest {
390433 DependentQueuedRequestKind :: EditEvent { .. }
391434 | DependentQueuedRequestKind :: RedactEvent
392435 | DependentQueuedRequestKind :: ReactEvent { .. }
393- | DependentQueuedRequestKind :: UploadFileWithThumbnail { .. } => {
436+ | DependentQueuedRequestKind :: UploadFileOrThumbnail { .. } => {
394437 // These are all aggregated events, or non-visible items (file upload producing
395438 // a new MXC ID).
396439 false
0 commit comments