]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Optimize channel with video in homepage
authorChocobozzz <me@florianbigard.com>
Mon, 18 Oct 2021 13:41:20 +0000 (15:41 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 18 Oct 2021 13:41:20 +0000 (15:41 +0200)
client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.html
client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts

index 2efc56ab2deb1e111b87b715ea898a913f41e555..de150aac9c749d44f0b79382bfeb02a04bbd6dce 100644 (file)
@@ -23,6 +23,6 @@
   <div class="video" *ngIf="video && displayLatestVideo">
     <div i18n class="video-label">Latest published video</div>
 
-    <my-video-miniature-markup [uuid]="video.uuid" [onlyDisplayTitle]="true"></my-video-miniature-markup>
+    <my-video-miniature-markup [video]="video" [onlyDisplayTitle]="true"></my-video-miniature-markup>
   </div>
 </div>
index 35b413b60abfee905cb15bd19fcb886c06bbcd84..e9c466a904bd641e4682aeff5fe47efe4d865683 100644 (file)
@@ -3,8 +3,8 @@ import { finalize, map, switchMap, tap } from 'rxjs/operators'
 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
 import { MarkdownService, Notifier, UserService } from '@app/core'
 import { FindInBulkService } from '@app/shared/shared-search'
-import { Video, VideoSortField } from '@shared/models/videos'
-import { VideoChannel, VideoService } from '../../shared-main'
+import { VideoSortField } from '@shared/models'
+import { Video, VideoChannel, VideoService } from '../../shared-main'
 import { CustomMarkupComponent } from './shared'
 
 /*
index 7315126e0b936779834f5c0fade78335cf5043bb..cbbacf77c65d6833b14553c6a1424d97b158ced7 100644 (file)
@@ -18,11 +18,10 @@ import { CustomMarkupComponent } from './shared'
 export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnInit {
   @Input() uuid: string
   @Input() onlyDisplayTitle: boolean
+  @Input() video: Video
 
   @Output() loaded = new EventEmitter<boolean>()
 
-  video: Video
-
   displayOptions: MiniatureDisplayOptions = {
     date: true,
     views: true,
@@ -51,6 +50,8 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI
       }
     }
 
+    if (this.video) return
+
     this.findInBulk.getVideo(this.uuid)
       .pipe(finalize(() => this.loaded.emit(true)))
       .subscribe({