From 57a49263e48739c31cd339730ac4cb24e3d5d723 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Sun, 7 Jan 2018 14:48:10 +0100 Subject: 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; --- client/src/app/shared/video/video.model.ts | 7 +++++-- client/src/app/shared/video/video.service.ts | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared/video') 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 { nsfw: boolean account: Account - private static createByString (account: string, serverHost: string) { + private static createByString (account: string, serverHost: string, apiURL: string) { + const thisHost = new URL(apiURL).host + if (serverHost.trim() === thisHost) + return account return account + '@' + serverHost } @@ -78,7 +81,7 @@ export class Video implements VideoServerModel { this.dislikes = hash.dislikes this.nsfw = hash.nsfw - this.by = Video.createByString(hash.accountName, hash.serverHost) + this.by = Video.createByString(hash.accountName, hash.serverHost, absoluteAPIUrl) } 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 { return this.setVideoRate(id, 'dislike') } + unsetVideoLike (id: number) { + return this.setVideoRate(id, 'none') + } + getUserVideoRating (id: number): Observable { const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating' -- cgit v1.2.3