@@ -298,7 +298,8 @@ export class CollectionStartPageDialog extends BtrixElement {
298
298
homeView === HomeView . URL &&
299
299
useThumbnail === "on" &&
300
300
this . selectedSnapshot &&
301
- this . collection ?. homeUrlPageId !== this . selectedSnapshot . pageId ;
301
+ this . collection ?. thumbnailSource ?. urlPageId !==
302
+ this . selectedSnapshot . pageId ;
302
303
// TODO get filename from rwp?
303
304
const fileName = `page-thumbnail_${ this . selectedSnapshot ?. pageId } .jpeg` ;
304
305
let file : File | undefined ;
@@ -325,12 +326,22 @@ export class CollectionStartPageDialog extends BtrixElement {
325
326
326
327
if ( shouldUpload ) {
327
328
try {
328
- if ( ! file || ! fileName ) throw new Error ( "file or fileName missing" ) ;
329
- await this . api . upload (
330
- `/orgs/${ this . orgId } /collections/${ this . collectionId } /thumbnail?filename=${ fileName } ` ,
331
- file ,
332
- ) ;
333
- await this . updateThumbnail ( { defaultThumbnailName : null } ) ;
329
+ if ( ! file || ! fileName || ! this . selectedSnapshot )
330
+ throw new Error ( "file or fileName missing" ) ;
331
+ const searchParams = new URLSearchParams ( {
332
+ filename : fileName ,
333
+ sourceUrl : this . selectedSnapshot . url ,
334
+ sourceTs : this . selectedSnapshot . ts ,
335
+ sourcePageId : this . selectedSnapshot . pageId ,
336
+ } ) ;
337
+ const tasks = [
338
+ this . api . upload (
339
+ `/orgs/${ this . orgId } /collections/${ this . collectionId } /thumbnail?${ searchParams . toString ( ) } ` ,
340
+ file ,
341
+ ) ,
342
+ this . updateThumbnail ( { defaultThumbnailName : null } ) ,
343
+ ] ;
344
+ await Promise . all ( tasks ) ;
334
345
335
346
this . notify . toast ( {
336
347
message : msg ( "Home view and collection thumbnail updated." ) ,
0 commit comments