aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-04 16:21:07 +0200
committerChocobozzz <me@florianbigard.com>2018-09-04 17:31:28 +0200
commit8cd7faaa331f83903f0bbaead288661218e38bdb (patch)
tree82e16eb1f7d4d7d259de9aab74c9865fd2ec7081 /client/src/app/shared
parenta94419a604f324305c9dbb607496a5bca9b63d04 (diff)
downloadPeerTube-8cd7faaa331f83903f0bbaead288661218e38bdb.tar.gz
PeerTube-8cd7faaa331f83903f0bbaead288661218e38bdb.tar.zst
PeerTube-8cd7faaa331f83903f0bbaead288661218e38bdb.zip
Better label for video privacies
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/video/video.service.ts29
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'
4import { Observable } from 'rxjs' 4import { Observable } from 'rxjs'
5import { Video as VideoServerModel, VideoDetails as VideoDetailsServerModel } from '../../../../../shared' 5import { Video as VideoServerModel, VideoDetails as VideoDetailsServerModel } from '../../../../../shared'
6import { ResultList } from '../../../../../shared/models/result-list.model' 6import { ResultList } from '../../../../../shared/models/result-list.model'
7import { UserVideoRate, UserVideoRateUpdate, VideoFilter, VideoRateType, VideoUpdate } from '../../../../../shared/models/videos' 7import {
8 UserVideoRate,
9 UserVideoRateUpdate,
10 VideoConstant,
11 VideoFilter,
12 VideoPrivacy,
13 VideoRateType,
14 VideoUpdate
15} from '../../../../../shared/models/videos'
8import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' 16import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
9import { environment } from '../../../environments/environment' 17import { environment } from '../../../environments/environment'
10import { ComponentPagination } from '../rest/component-pagination.model' 18import { ComponentPagination } from '../rest/component-pagination.model'
@@ -22,6 +30,7 @@ import { VideoChannelService } from '@app/shared/video-channel/video-channel.ser
22import { ServerService } from '@app/core' 30import { ServerService } from '@app/core'
23import { UserSubscriptionService } from '@app/shared/user-subscription' 31import { UserSubscriptionService } from '@app/shared/user-subscription'
24import { VideoChannel } from '@app/shared/video-channel/video-channel.model' 32import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
33import { I18n } from '@ngx-translate/i18n-polyfill'
25 34
26export interface VideosProvider { 35export 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 = {