diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 5c0674e58..4a78d70ea 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -4,7 +4,15 @@ import { Injectable } from '@angular/core' | |||
4 | import { Observable } from 'rxjs' | 4 | import { Observable } from 'rxjs' |
5 | import { Video as VideoServerModel, VideoDetails as VideoDetailsServerModel } from '../../../../../shared' | 5 | import { Video as VideoServerModel, VideoDetails as VideoDetailsServerModel } from '../../../../../shared' |
6 | import { ResultList } from '../../../../../shared/models/result-list.model' | 6 | import { ResultList } from '../../../../../shared/models/result-list.model' |
7 | import { UserVideoRate, UserVideoRateUpdate, VideoFilter, VideoRateType, VideoUpdate } from '../../../../../shared/models/videos' | 7 | import { |
8 | UserVideoRate, | ||
9 | UserVideoRateUpdate, | ||
10 | VideoConstant, | ||
11 | VideoFilter, | ||
12 | VideoPrivacy, | ||
13 | VideoRateType, | ||
14 | VideoUpdate | ||
15 | } from '../../../../../shared/models/videos' | ||
8 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | 16 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' |
9 | import { environment } from '../../../environments/environment' | 17 | import { environment } from '../../../environments/environment' |
10 | import { ComponentPagination } from '../rest/component-pagination.model' | 18 | import { ComponentPagination } from '../rest/component-pagination.model' |
@@ -22,6 +30,7 @@ import { VideoChannelService } from '@app/shared/video-channel/video-channel.ser | |||
22 | import { ServerService } from '@app/core' | 30 | import { ServerService } from '@app/core' |
23 | import { UserSubscriptionService } from '@app/shared/user-subscription' | 31 | import { UserSubscriptionService } from '@app/shared/user-subscription' |
24 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 32 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
33 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
25 | 34 | ||
26 | export interface VideosProvider { | 35 | export interface VideosProvider { |
27 | getVideos ( | 36 | getVideos ( |
@@ -41,7 +50,8 @@ export class VideoService implements VideosProvider { | |||
41 | private authHttp: HttpClient, | 50 | private authHttp: HttpClient, |
42 | private restExtractor: RestExtractor, | 51 | private restExtractor: RestExtractor, |
43 | private restService: RestService, | 52 | private restService: RestService, |
44 | private serverService: ServerService | 53 | private serverService: ServerService, |
54 | private i18n: I18n | ||
45 | ) {} | 55 | ) {} |
46 | 56 | ||
47 | getVideoViewUrl (uuid: string) { | 57 | getVideoViewUrl (uuid: string) { |
@@ -300,6 +310,21 @@ export class VideoService implements VideosProvider { | |||
300 | ) | 310 | ) |
301 | } | 311 | } |
302 | 312 | ||
313 | explainedPrivacyLabels (privacies: VideoConstant<VideoPrivacy>[]) { | ||
314 | const newPrivacies = privacies.slice() | ||
315 | |||
316 | const privatePrivacy = newPrivacies.find(p => p.id === VideoPrivacy.PRIVATE) | ||
317 | if (privatePrivacy) privatePrivacy.label = this.i18n('Only I can see this video') | ||
318 | |||
319 | const unlistedPrivacy = newPrivacies.find(p => p.id === VideoPrivacy.UNLISTED) | ||
320 | if (unlistedPrivacy) unlistedPrivacy.label = this.i18n('Only people with the private link can see this video') | ||
321 | |||
322 | const publicPrivacy = newPrivacies.find(p => p.id === VideoPrivacy.PUBLIC) | ||
323 | if (publicPrivacy) publicPrivacy.label = this.i18n('Anyone can see this video') | ||
324 | |||
325 | return privacies | ||
326 | } | ||
327 | |||
303 | private setVideoRate (id: number, rateType: VideoRateType) { | 328 | private setVideoRate (id: number, rateType: VideoRateType) { |
304 | const url = VideoService.BASE_VIDEO_URL + id + '/rate' | 329 | const url = VideoService.BASE_VIDEO_URL + id + '/rate' |
305 | const body: UserVideoRateUpdate = { | 330 | const body: UserVideoRateUpdate = { |