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=4c8a099198cd3af049847df91140735354b85a92;hp=ba61aaf51bfe82d6c71bb9bf6b872c0b6d337b6e;hpb=3da38d6e9f8d600476be276666ac7223aa5f172c;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 ba61aaf51..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,10 +1,10 @@ import { finalize } from 'rxjs/operators' import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { AuthService, Notifier } from '@app/core' -import { Video, VideoService } from '../../shared-main' +import { FindInBulkService } from '@app/shared/shared-search' +import { Video } from '../../shared-main' import { MiniatureDisplayOptions } from '../../shared-video-miniature' import { CustomMarkupComponent } from './shared' -import { FindInBulkService } from '@app/shared/shared-search' /* * Markup component that creates a video miniature only @@ -18,11 +18,10 @@ import { FindInBulkService } from '@app/shared/shared-search' 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, @@ -51,12 +50,14 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI } } + if (this.video) return + this.findInBulk.getVideo(this.uuid) .pipe(finalize(() => this.loaded.emit(true))) - .subscribe( - video => this.video = video, + .subscribe({ + next: video => this.video = video, - err => this.notifier.error('Error in video miniature component: ' + err.message) - ) + error: err => this.notifier.error($localize`Error in video miniature component: ${err.message}`) + }) } }