diff options
Diffstat (limited to 'client/src/app/shared/users/user-notification.model.ts')
-rw-r--r-- | client/src/app/shared/users/user-notification.model.ts | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/client/src/app/shared/users/user-notification.model.ts b/client/src/app/shared/users/user-notification.model.ts index 5ff816fb8..125d2120c 100644 --- a/client/src/app/shared/users/user-notification.model.ts +++ b/client/src/app/shared/users/user-notification.model.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { UserNotification as UserNotificationServer, UserNotificationType, VideoInfo } from '../../../../../shared' | 1 | import { UserNotification as UserNotificationServer, UserNotificationType, VideoInfo, ActorInfo } from '../../../../../shared' |
2 | import { Actor } from '@app/shared/actor/actor.model' | ||
2 | 3 | ||
3 | export class UserNotification implements UserNotificationServer { | 4 | export class UserNotification implements UserNotificationServer { |
4 | id: number | 5 | id: number |
@@ -6,10 +7,7 @@ export class UserNotification implements UserNotificationServer { | |||
6 | read: boolean | 7 | read: boolean |
7 | 8 | ||
8 | video?: VideoInfo & { | 9 | video?: VideoInfo & { |
9 | channel: { | 10 | channel: ActorInfo & { avatarUrl?: string } |
10 | id: number | ||
11 | displayName: string | ||
12 | } | ||
13 | } | 11 | } |
14 | 12 | ||
15 | videoImport?: { | 13 | videoImport?: { |
@@ -23,10 +21,7 @@ export class UserNotification implements UserNotificationServer { | |||
23 | comment?: { | 21 | comment?: { |
24 | id: number | 22 | id: number |
25 | threadId: number | 23 | threadId: number |
26 | account: { | 24 | account: ActorInfo & { avatarUrl?: string } |
27 | id: number | ||
28 | displayName: string | ||
29 | } | ||
30 | video: VideoInfo | 25 | video: VideoInfo |
31 | } | 26 | } |
32 | 27 | ||
@@ -40,18 +35,11 @@ export class UserNotification implements UserNotificationServer { | |||
40 | video: VideoInfo | 35 | video: VideoInfo |
41 | } | 36 | } |
42 | 37 | ||
43 | account?: { | 38 | account?: ActorInfo & { avatarUrl?: string } |
44 | id: number | ||
45 | displayName: string | ||
46 | name: string | ||
47 | } | ||
48 | 39 | ||
49 | actorFollow?: { | 40 | actorFollow?: { |
50 | id: number | 41 | id: number |
51 | follower: { | 42 | follower: ActorInfo & { avatarUrl?: string } |
52 | name: string | ||
53 | displayName: string | ||
54 | } | ||
55 | following: { | 43 | following: { |
56 | type: 'account' | 'channel' | 44 | type: 'account' | 'channel' |
57 | name: string | 45 | name: string |
@@ -76,12 +64,22 @@ export class UserNotification implements UserNotificationServer { | |||
76 | this.read = hash.read | 64 | this.read = hash.read |
77 | 65 | ||
78 | this.video = hash.video | 66 | this.video = hash.video |
67 | if (this.video) this.setAvatarUrl(this.video.channel) | ||
68 | |||
79 | this.videoImport = hash.videoImport | 69 | this.videoImport = hash.videoImport |
70 | |||
80 | this.comment = hash.comment | 71 | this.comment = hash.comment |
72 | if (this.comment) this.setAvatarUrl(this.comment.account) | ||
73 | |||
81 | this.videoAbuse = hash.videoAbuse | 74 | this.videoAbuse = hash.videoAbuse |
75 | |||
82 | this.videoBlacklist = hash.videoBlacklist | 76 | this.videoBlacklist = hash.videoBlacklist |
77 | |||
83 | this.account = hash.account | 78 | this.account = hash.account |
79 | if (this.account) this.setAvatarUrl(this.account) | ||
80 | |||
84 | this.actorFollow = hash.actorFollow | 81 | this.actorFollow = hash.actorFollow |
82 | if (this.actorFollow) this.setAvatarUrl(this.actorFollow.follower) | ||
85 | 83 | ||
86 | this.createdAt = hash.createdAt | 84 | this.createdAt = hash.createdAt |
87 | this.updatedAt = hash.updatedAt | 85 | this.updatedAt = hash.updatedAt |
@@ -97,6 +95,7 @@ export class UserNotification implements UserNotificationServer { | |||
97 | 95 | ||
98 | case UserNotificationType.NEW_COMMENT_ON_MY_VIDEO: | 96 | case UserNotificationType.NEW_COMMENT_ON_MY_VIDEO: |
99 | case UserNotificationType.COMMENT_MENTION: | 97 | case UserNotificationType.COMMENT_MENTION: |
98 | this.accountUrl = this.buildAccountUrl(this.comment.account) | ||
100 | this.commentUrl = [ this.buildVideoUrl(this.comment.video), { threadId: this.comment.threadId } ] | 99 | this.commentUrl = [ this.buildVideoUrl(this.comment.video), { threadId: this.comment.threadId } ] |
101 | break | 100 | break |
102 | 101 | ||
@@ -138,8 +137,8 @@ export class UserNotification implements UserNotificationServer { | |||
138 | return '/videos/watch/' + video.uuid | 137 | return '/videos/watch/' + video.uuid |
139 | } | 138 | } |
140 | 139 | ||
141 | private buildAccountUrl (account: { name: string }) { | 140 | private buildAccountUrl (account: { name: string, host: string }) { |
142 | return '/accounts/' + account.name | 141 | return '/accounts/' + Actor.CREATE_BY_STRING(account.name, account.host) |
143 | } | 142 | } |
144 | 143 | ||
145 | private buildVideoImportUrl () { | 144 | private buildVideoImportUrl () { |
@@ -150,4 +149,7 @@ export class UserNotification implements UserNotificationServer { | |||
150 | return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName | 149 | return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName |
151 | } | 150 | } |
152 | 151 | ||
152 | private setAvatarUrl (actor: { avatarUrl?: string, avatar?: { path: string } }) { | ||
153 | actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor) | ||
154 | } | ||
153 | } | 155 | } |