diff options
Diffstat (limited to 'client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts')
-rw-r--r-- | client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts index a8e5a4885..cd592eab0 100644 --- a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts +++ b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core' | 1 | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Video } from '@app/shared/video/video.model' | 2 | import { Video } from '@app/shared/video/video.model' |
3 | import { VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models' | 3 | import { ServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models' |
4 | import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' | 4 | import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' |
5 | import { ActivatedRoute } from '@angular/router' | 5 | import { ActivatedRoute } from '@angular/router' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -17,7 +17,7 @@ import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist- | |||
17 | templateUrl: './video-playlist-element-miniature.component.html', | 17 | templateUrl: './video-playlist-element-miniature.component.html', |
18 | changeDetection: ChangeDetectionStrategy.OnPush | 18 | changeDetection: ChangeDetectionStrategy.OnPush |
19 | }) | 19 | }) |
20 | export class VideoPlaylistElementMiniatureComponent { | 20 | export class VideoPlaylistElementMiniatureComponent implements OnInit { |
21 | @ViewChild('moreDropdown', { static: false }) moreDropdown: NgbDropdown | 21 | @ViewChild('moreDropdown', { static: false }) moreDropdown: NgbDropdown |
22 | 22 | ||
23 | @Input() playlist: VideoPlaylist | 23 | @Input() playlist: VideoPlaylist |
@@ -39,6 +39,8 @@ export class VideoPlaylistElementMiniatureComponent { | |||
39 | stopTimestamp: number | 39 | stopTimestamp: number |
40 | } = {} as any | 40 | } = {} as any |
41 | 41 | ||
42 | private serverConfig: ServerConfig | ||
43 | |||
42 | constructor ( | 44 | constructor ( |
43 | private authService: AuthService, | 45 | private authService: AuthService, |
44 | private serverService: ServerService, | 46 | private serverService: ServerService, |
@@ -51,6 +53,15 @@ export class VideoPlaylistElementMiniatureComponent { | |||
51 | private cdr: ChangeDetectorRef | 53 | private cdr: ChangeDetectorRef |
52 | ) {} | 54 | ) {} |
53 | 55 | ||
56 | ngOnInit (): void { | ||
57 | this.serverConfig = this.serverService.getTmpConfig() | ||
58 | this.serverService.getConfig() | ||
59 | .subscribe(config => { | ||
60 | this.serverConfig = config | ||
61 | this.cdr.detectChanges() | ||
62 | }) | ||
63 | } | ||
64 | |||
54 | isUnavailable (e: VideoPlaylistElement) { | 65 | isUnavailable (e: VideoPlaylistElement) { |
55 | return e.type === VideoPlaylistElementType.UNAVAILABLE | 66 | return e.type === VideoPlaylistElementType.UNAVAILABLE |
56 | } | 67 | } |
@@ -80,7 +91,7 @@ export class VideoPlaylistElementMiniatureComponent { | |||
80 | } | 91 | } |
81 | 92 | ||
82 | isVideoBlur (video: Video) { | 93 | isVideoBlur (video: Video) { |
83 | return video.isVideoNSFWForUser(this.authService.getUser(), this.serverService.getConfig()) | 94 | return video.isVideoNSFWForUser(this.authService.getUser(), this.serverConfig) |
84 | } | 95 | } |
85 | 96 | ||
86 | removeFromPlaylist (playlistElement: VideoPlaylistElement) { | 97 | removeFromPlaylist (playlistElement: VideoPlaylistElement) { |