aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video
diff options
context:
space:
mode:
authorBenjamin Bouvier <public@benj.me>2018-01-07 14:48:10 +0100
committerChocobozzz <me@florianbigard.com>2018-01-07 14:48:10 +0100
commit57a49263e48739c31cd339730ac4cb24e3d5d723 (patch)
tree520de9caa84113e704b39ae3b6f068a4fca7a66d /client/src/app/shared/video
parentcbca00dfc14fe47260e8d081f4ed0bec7c66fd09 (diff)
downloadPeerTube-57a49263e48739c31cd339730ac4cb24e3d5d723.tar.gz
PeerTube-57a49263e48739c31cd339730ac4cb24e3d5d723.tar.zst
PeerTube-57a49263e48739c31cd339730ac4cb24e3d5d723.zip
A few updates for the watch video view (#181)
* Fixes #156: Filter out the video being watched from the list of other videos of the same author; * Fixes #167: in the video view, hide the author's domain when it's from the current host; * Fixes #171: Allow undoing a like/dislike;
Diffstat (limited to 'client/src/app/shared/video')
-rw-r--r--client/src/app/shared/video/video.model.ts7
-rw-r--r--client/src/app/shared/video/video.service.ts4
2 files changed, 9 insertions, 2 deletions
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index 060bf933f..a4b90ad94 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -35,7 +35,10 @@ export class Video implements VideoServerModel {
35 nsfw: boolean 35 nsfw: boolean
36 account: Account 36 account: Account
37 37
38 private static createByString (account: string, serverHost: string) { 38 private static createByString (account: string, serverHost: string, apiURL: string) {
39 const thisHost = new URL(apiURL).host
40 if (serverHost.trim() === thisHost)
41 return account
39 return account + '@' + serverHost 42 return account + '@' + serverHost
40 } 43 }
41 44
@@ -78,7 +81,7 @@ export class Video implements VideoServerModel {
78 this.dislikes = hash.dislikes 81 this.dislikes = hash.dislikes
79 this.nsfw = hash.nsfw 82 this.nsfw = hash.nsfw
80 83
81 this.by = Video.createByString(hash.accountName, hash.serverHost) 84 this.by = Video.createByString(hash.accountName, hash.serverHost, absoluteAPIUrl)
82 } 85 }
83 86
84 isVideoNSFWForUser (user: User) { 87 isVideoNSFWForUser (user: User) {
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 073acb2b6..50761ca0c 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -136,6 +136,10 @@ export class VideoService {
136 return this.setVideoRate(id, 'dislike') 136 return this.setVideoRate(id, 'dislike')
137 } 137 }
138 138
139 unsetVideoLike (id: number) {
140 return this.setVideoRate(id, 'none')
141 }
142
139 getUserVideoRating (id: number): Observable<UserVideoRate> { 143 getUserVideoRating (id: number): Observable<UserVideoRate> {
140 const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating' 144 const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating'
141 145