aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/shared
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-04-04 21:37:03 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-04-04 21:37:03 +0200
commit92fb909c9b4a92a00b0d0da7629e6fb003de281b (patch)
tree8119c6720d5dec0474983501843f1e699fde150a /client/src/app/videos/shared
parent1d49e1e27d63db1dfc9a7fd28c9902f488831a89 (diff)
downloadPeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.tar.gz
PeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.tar.zst
PeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.zip
Client: Handle NSFW video
Diffstat (limited to 'client/src/app/videos/shared')
-rw-r--r--client/src/app/videos/shared/video.model.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index 5ed622dce..3c588c446 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -1,3 +1,5 @@
1import { User } from '../../shared';
2
1export class Video { 3export class Video {
2 author: string; 4 author: string;
3 by: string; 5 by: string;
@@ -16,6 +18,7 @@ export class Video {
16 views: number; 18 views: number;
17 likes: number; 19 likes: number;
18 dislikes: number; 20 dislikes: number;
21 nsfw: boolean;
19 22
20 private static createByString(author: string, podHost: string) { 23 private static createByString(author: string, podHost: string) {
21 return author + '@' + podHost; 24 return author + '@' + podHost;
@@ -47,6 +50,7 @@ export class Video {
47 views: number, 50 views: number,
48 likes: number, 51 likes: number,
49 dislikes: number, 52 dislikes: number,
53 nsfw: boolean
50 }) { 54 }) {
51 this.author = hash.author; 55 this.author = hash.author;
52 this.createdAt = new Date(hash.createdAt); 56 this.createdAt = new Date(hash.createdAt);
@@ -64,11 +68,17 @@ export class Video {
64 this.views = hash.views; 68 this.views = hash.views;
65 this.likes = hash.likes; 69 this.likes = hash.likes;
66 this.dislikes = hash.dislikes; 70 this.dislikes = hash.dislikes;
71 this.nsfw = hash.nsfw;
67 72
68 this.by = Video.createByString(hash.author, hash.podHost); 73 this.by = Video.createByString(hash.author, hash.podHost);
69 } 74 }
70 75
71 isRemovableBy(user) { 76 isRemovableBy(user: User) {
72 return this.isLocal === true && user && this.author === user.username; 77 return this.isLocal === true && user && this.author === user.username;
73 } 78 }
79
80 isVideoNSFWForUser(user: User) {
81 // If the video is NSFW and the user is not logged in, or the user does not want to display NSFW videos...
82 return (this.nsfw && (!user || user.displayNSFW === false));
83 }
74} 84}