X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-custom-markup%2Fpeertube-custom-tags%2Fvideo-miniature-markup.component.ts;h=cbbacf77c65d6833b14553c6a1424d97b158ced7;hb=2760b454a761f6af3138b2fb5f34340772ab0d1e;hp=6ee5123e0e673fef015efeb0e1933e3745b8d1ec;hpb=0ca454e3bdf89390d1a48760ab555ddd8725c82d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts index 6ee5123e0..cbbacf77c 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts @@ -1,6 +1,8 @@ +import { finalize } from 'rxjs/operators' import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' -import { AuthService } from '@app/core' -import { Video, VideoService } from '../../shared-main' +import { AuthService, Notifier } from '@app/core' +import { FindInBulkService } from '@app/shared/shared-search' +import { Video } from '../../shared-main' import { MiniatureDisplayOptions } from '../../shared-video-miniature' import { CustomMarkupComponent } from './shared' @@ -16,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() - video: Video - displayOptions: MiniatureDisplayOptions = { date: true, views: true, @@ -34,7 +35,8 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI constructor ( private auth: AuthService, - private videoService: VideoService + private findInBulk: FindInBulkService, + private notifier: Notifier ) { } getUser () { @@ -48,11 +50,14 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI } } - this.videoService.getVideo({ videoId: this.uuid }) + if (this.video) return + + this.findInBulk.getVideo(this.uuid) + .pipe(finalize(() => this.loaded.emit(true))) .subscribe({ next: video => this.video = video, - complete: () => this.loaded.emit(true) + error: err => this.notifier.error($localize`Error in video miniature component: ${err.message}`) }) } }