diff options
author | kimsible <kimsible@users.noreply.github.com> | 2020-11-18 19:20:05 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-25 11:12:06 +0100 |
commit | c418d483004dfbae9ea38d54aa1577db46d34a8a (patch) | |
tree | c4fd4ec790c6e5d6bc44e887090a8286e10fffd2 /client/src/app/shared/shared-main/users | |
parent | 18490b07650d77d7fe376970b749af5a8c672fd6 (diff) | |
download | PeerTube-c418d483004dfbae9ea38d54aa1577db46d34a8a.tar.gz PeerTube-c418d483004dfbae9ea38d54aa1577db46d34a8a.tar.zst PeerTube-c418d483004dfbae9ea38d54aa1577db46d34a8a.zip |
Add new default different avatar for channel and account
Diffstat (limited to 'client/src/app/shared/shared-main/users')
-rw-r--r-- | client/src/app/shared/shared-main/users/user-notification.model.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts index 648bb7fe0..b1df4a584 100644 --- a/client/src/app/shared/shared-main/users/user-notification.model.ts +++ b/client/src/app/shared/shared-main/users/user-notification.model.ts | |||
@@ -7,7 +7,7 @@ import { | |||
7 | VideoInfo, | 7 | VideoInfo, |
8 | UserRight | 8 | UserRight |
9 | } from '@shared/models' | 9 | } from '@shared/models' |
10 | import { Actor } from '../account/actor.model' | 10 | import { Account, Actor, VideoChannel } from '@app/shared/shared-main' |
11 | import { AuthUser } from '@app/core' | 11 | import { AuthUser } from '@app/core' |
12 | 12 | ||
13 | export class UserNotification implements UserNotificationServer { | 13 | export class UserNotification implements UserNotificationServer { |
@@ -95,22 +95,22 @@ export class UserNotification implements UserNotificationServer { | |||
95 | // To prevent a notification popup crash in case of bug, wrap it inside a try/catch | 95 | // To prevent a notification popup crash in case of bug, wrap it inside a try/catch |
96 | try { | 96 | try { |
97 | this.video = hash.video | 97 | this.video = hash.video |
98 | if (this.video) this.setAvatarUrl(this.video.channel) | 98 | if (this.video) this.setVideoChannelAvatarUrl(this.video.channel) |
99 | 99 | ||
100 | this.videoImport = hash.videoImport | 100 | this.videoImport = hash.videoImport |
101 | 101 | ||
102 | this.comment = hash.comment | 102 | this.comment = hash.comment |
103 | if (this.comment) this.setAvatarUrl(this.comment.account) | 103 | if (this.comment) this.setAccountAvatarUrl(this.comment.account) |
104 | 104 | ||
105 | this.abuse = hash.abuse | 105 | this.abuse = hash.abuse |
106 | 106 | ||
107 | this.videoBlacklist = hash.videoBlacklist | 107 | this.videoBlacklist = hash.videoBlacklist |
108 | 108 | ||
109 | this.account = hash.account | 109 | this.account = hash.account |
110 | if (this.account) this.setAvatarUrl(this.account) | 110 | if (this.account) this.setAccountAvatarUrl(this.account) |
111 | 111 | ||
112 | this.actorFollow = hash.actorFollow | 112 | this.actorFollow = hash.actorFollow |
113 | if (this.actorFollow) this.setAvatarUrl(this.actorFollow.follower) | 113 | if (this.actorFollow) this.setAccountAvatarUrl(this.actorFollow.follower) |
114 | 114 | ||
115 | this.createdAt = hash.createdAt | 115 | this.createdAt = hash.createdAt |
116 | this.updatedAt = hash.updatedAt | 116 | this.updatedAt = hash.updatedAt |
@@ -222,7 +222,11 @@ export class UserNotification implements UserNotificationServer { | |||
222 | return [ this.buildVideoUrl(comment.video), { threadId: comment.threadId } ] | 222 | return [ this.buildVideoUrl(comment.video), { threadId: comment.threadId } ] |
223 | } | 223 | } |
224 | 224 | ||
225 | private setAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { | 225 | private setAccountAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { |
226 | actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor) | 226 | actor.avatarUrl = Account.GET_ACTOR_AVATAR_URL(actor) |
227 | } | ||
228 | |||
229 | private setVideoChannelAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { | ||
230 | actor.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(actor) | ||
227 | } | 231 | } |
228 | } | 232 | } |