diff options
Diffstat (limited to 'client/src/app/shared/video')
-rw-r--r-- | client/src/app/shared/video/abstract-video-list.ts | 10 | ||||
-rw-r--r-- | client/src/app/shared/video/video-miniature.component.ts | 9 | ||||
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 4 |
3 files changed, 17 insertions, 6 deletions
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 2926b179b..faeea27d9 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -13,7 +13,7 @@ import { Notifier, ServerService } from '@app/core' | |||
13 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' | 13 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' |
14 | import { I18n } from '@ngx-translate/i18n-polyfill' | 14 | import { I18n } from '@ngx-translate/i18n-polyfill' |
15 | import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date' | 15 | import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date' |
16 | import { ResultList } from '@shared/models' | 16 | import { ResultList, ServerConfig } from '@shared/models' |
17 | 17 | ||
18 | enum GroupDate { | 18 | enum GroupDate { |
19 | UNKNOWN = 0, | 19 | UNKNOWN = 0, |
@@ -61,6 +61,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
61 | 61 | ||
62 | onDataSubject = new Subject<any[]>() | 62 | onDataSubject = new Subject<any[]>() |
63 | 63 | ||
64 | protected serverConfig: ServerConfig | ||
65 | |||
64 | protected abstract notifier: Notifier | 66 | protected abstract notifier: Notifier |
65 | protected abstract authService: AuthService | 67 | protected abstract authService: AuthService |
66 | protected abstract route: ActivatedRoute | 68 | protected abstract route: ActivatedRoute |
@@ -85,6 +87,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
85 | } | 87 | } |
86 | 88 | ||
87 | ngOnInit () { | 89 | ngOnInit () { |
90 | this.serverConfig = this.serverService.getTmpConfig() | ||
91 | this.serverService.getConfig() | ||
92 | .subscribe(config => this.serverConfig = config) | ||
93 | |||
88 | this.groupedDateLabels = { | 94 | this.groupedDateLabels = { |
89 | [GroupDate.UNKNOWN]: null, | 95 | [GroupDate.UNKNOWN]: null, |
90 | [GroupDate.TODAY]: this.i18n('Today'), | 96 | [GroupDate.TODAY]: this.i18n('Today'), |
@@ -251,7 +257,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
251 | } | 257 | } |
252 | 258 | ||
253 | let path = this.router.url | 259 | let path = this.router.url |
254 | if (!path || path === '/') path = this.serverService.getConfig().instance.defaultClientRoute | 260 | if (!path || path === '/') path = this.serverConfig.instance.defaultClientRoute |
255 | 261 | ||
256 | this.router.navigate([ path ], { queryParams, replaceUrl: true, queryParamsHandling: 'merge' }) | 262 | this.router.navigate([ path ], { queryParams, replaceUrl: true, queryParamsHandling: 'merge' }) |
257 | } | 263 | } |
diff --git a/client/src/app/shared/video/video-miniature.component.ts b/client/src/app/shared/video/video-miniature.component.ts index d5c7dfd9b..9fffc7ddb 100644 --- a/client/src/app/shared/video/video-miniature.component.ts +++ b/client/src/app/shared/video/video-miniature.component.ts | |||
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, LOCALE | |||
2 | import { User } from '../users' | 2 | import { User } from '../users' |
3 | import { Video } from './video.model' | 3 | import { Video } from './video.model' |
4 | import { ServerService } from '@app/core' | 4 | import { ServerService } from '@app/core' |
5 | import { VideoPrivacy, VideoState } from '../../../../../shared' | 5 | import { ServerConfig, VideoPrivacy, VideoState } from '../../../../../shared' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { VideoActionsDisplayType } from '@app/shared/video/video-actions-dropdown.component' | 7 | import { VideoActionsDisplayType } from '@app/shared/video/video-actions-dropdown.component' |
8 | import { ScreenService } from '@app/shared/misc/screen.service' | 8 | import { ScreenService } from '@app/shared/misc/screen.service' |
@@ -55,6 +55,7 @@ export class VideoMiniatureComponent implements OnInit { | |||
55 | report: true | 55 | report: true |
56 | } | 56 | } |
57 | showActions = false | 57 | showActions = false |
58 | serverConfig: ServerConfig | ||
58 | 59 | ||
59 | private ownerDisplayTypeChosen: 'account' | 'videoChannel' | 60 | private ownerDisplayTypeChosen: 'account' | 'videoChannel' |
60 | 61 | ||
@@ -66,10 +67,14 @@ export class VideoMiniatureComponent implements OnInit { | |||
66 | ) { } | 67 | ) { } |
67 | 68 | ||
68 | get isVideoBlur () { | 69 | get isVideoBlur () { |
69 | return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig()) | 70 | return this.video.isVideoNSFWForUser(this.user, this.serverConfig) |
70 | } | 71 | } |
71 | 72 | ||
72 | ngOnInit () { | 73 | ngOnInit () { |
74 | this.serverConfig = this.serverService.getTmpConfig() | ||
75 | this.serverService.getConfig() | ||
76 | .subscribe(config => this.serverConfig = config) | ||
77 | |||
73 | this.setUpBy() | 78 | this.setUpBy() |
74 | 79 | ||
75 | // We rely on mouseenter to lazy load actions | 80 | // We rely on mouseenter to lazy load actions |
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index b0fa55966..9adf46495 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -64,7 +64,7 @@ export class VideoService implements VideosProvider { | |||
64 | } | 64 | } |
65 | 65 | ||
66 | getVideo (options: { videoId: string }): Observable<VideoDetails> { | 66 | getVideo (options: { videoId: string }): Observable<VideoDetails> { |
67 | return this.serverService.localeObservable | 67 | return this.serverService.getServerLocale() |
68 | .pipe( | 68 | .pipe( |
69 | switchMap(translations => { | 69 | switchMap(translations => { |
70 | return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + options.videoId) | 70 | return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + options.videoId) |
@@ -315,7 +315,7 @@ export class VideoService implements VideosProvider { | |||
315 | } | 315 | } |
316 | 316 | ||
317 | extractVideos (result: ResultList<VideoServerModel>) { | 317 | extractVideos (result: ResultList<VideoServerModel>) { |
318 | return this.serverService.localeObservable | 318 | return this.serverService.getServerLocale() |
319 | .pipe( | 319 | .pipe( |
320 | map(translations => { | 320 | map(translations => { |
321 | const videosJson = result.data | 321 | const videosJson = result.data |