diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/video/video.model.ts | 7 | ||||
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 4 |
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 | ||