From 2243730c8edf210c0a3ffc161bac89785f6a52f0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Apr 2018 14:52:10 +0200 Subject: Add information concerning video privacy in my videos list --- .../app/account/account-videos/account-videos.component.html | 1 + .../app/account/account-videos/account-videos.component.scss | 6 +++++- client/src/app/core/auth/auth-user.model.ts | 8 ++++---- client/src/app/shared/video/video-details.model.ts | 11 +---------- client/src/app/shared/video/video.model.ts | 4 +++- 5 files changed, 14 insertions(+), 16 deletions(-) (limited to 'client') diff --git a/client/src/app/account/account-videos/account-videos.component.html b/client/src/app/account/account-videos/account-videos.component.html index d7e2230b0..66ce3a77b 100644 --- a/client/src/app/account/account-videos/account-videos.component.html +++ b/client/src/app/account/account-videos/account-videos.component.html @@ -18,6 +18,7 @@
{{ video.name }} {{ video.createdAt | myFromNow }} - {{ video.views | myNumberFormatter }} views +
{{ video.privacy.label }}
diff --git a/client/src/app/account/account-videos/account-videos.component.scss b/client/src/app/account/account-videos/account-videos.component.scss index 449cc6af4..f276ea389 100644 --- a/client/src/app/account/account-videos/account-videos.component.scss +++ b/client/src/app/account/account-videos/account-videos.component.scss @@ -79,8 +79,12 @@ font-weight: $font-semibold; } - .video-info-date-views { + .video-info-date-views, .video-info-private { font-size: 13px; + + &.video-info-private { + font-weight: $font-semibold; + } } } diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 60fe57899..74ed1c580 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts @@ -71,7 +71,7 @@ export class AuthUser extends User { ROLE: 'role', EMAIL: 'email', USERNAME: 'username', - DEFAULT_NSFW_POLICY: 'nsfw_policy', + NSFW_POLICY: 'nsfw_policy', AUTO_PLAY_VIDEO: 'auto_play_video' } @@ -86,7 +86,7 @@ export class AuthUser extends User { username: peertubeLocalStorage.getItem(this.KEYS.USERNAME), email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, - nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.DEFAULT_NSFW_POLICY) as NSFWPolicyType, + nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' }, Tokens.load() @@ -100,7 +100,7 @@ export class AuthUser extends User { peertubeLocalStorage.removeItem(this.KEYS.USERNAME) peertubeLocalStorage.removeItem(this.KEYS.ID) peertubeLocalStorage.removeItem(this.KEYS.ROLE) - peertubeLocalStorage.removeItem(this.KEYS.DEFAULT_NSFW_POLICY) + peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) peertubeLocalStorage.removeItem(this.KEYS.EMAIL) Tokens.flush() @@ -137,7 +137,7 @@ export class AuthUser extends User { peertubeLocalStorage.setItem(AuthUser.KEYS.USERNAME, this.username) peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) - peertubeLocalStorage.setItem(AuthUser.KEYS.DEFAULT_NSFW_POLICY, this.nsfwPolicy.toString()) + peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) this.tokens.save() } diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts index a1f7207a2..5397aa37f 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/video/video-details.model.ts @@ -1,17 +1,9 @@ -import { - UserRight, - VideoChannel, - VideoDetails as VideoDetailsServerModel, - VideoFile, - VideoPrivacy -} from '../../../../../shared' +import { UserRight, VideoChannel, VideoDetails as VideoDetailsServerModel, VideoFile } from '../../../../../shared' import { Account } from '../../../../../shared/models/actors' -import { VideoConstant } from '../../../../../shared/models/videos/video.model' import { AuthUser } from '../../core' import { Video } from '../../shared/video/video.model' export class VideoDetails extends Video implements VideoDetailsServerModel { - privacy: VideoConstant descriptionPath: string support: string channel: VideoChannel @@ -26,7 +18,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { constructor (hash: VideoDetailsServerModel) { super(hash) - this.privacy = hash.privacy this.descriptionPath = hash.descriptionPath this.files = hash.files this.channel = hash.channel diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts index adc248a1e..e25c172e0 100644 --- a/client/src/app/shared/video/video.model.ts +++ b/client/src/app/shared/video/video.model.ts @@ -1,6 +1,6 @@ import { Account } from '@app/shared/account/account.model' import { User } from '../' -import { Video as VideoServerModel } from '../../../../../shared' +import { Video as VideoServerModel, VideoPrivacy } from '../../../../../shared' import { Avatar } from '../../../../../shared/models/avatars/avatar.model' import { VideoConstant } from '../../../../../shared/models/videos/video.model' import { getAbsoluteAPIUrl } from '../misc/utils' @@ -14,6 +14,7 @@ export class Video implements VideoServerModel { category: VideoConstant licence: VideoConstant language: VideoConstant + privacy: VideoConstant description: string duration: number durationLabel: string @@ -62,6 +63,7 @@ export class Video implements VideoServerModel { this.category = hash.category this.licence = hash.licence this.language = hash.language + this.privacy = hash.privacy this.description = hash.description this.duration = hash.duration this.durationLabel = Video.createDurationString(hash.duration) -- cgit v1.2.3