-import { UserNotification as UserNotificationServer, UserNotificationType, VideoInfo } from '../../../../../shared'
+import { UserNotification as UserNotificationServer, UserNotificationType, VideoInfo, ActorInfo } from '../../../../../shared'
+import { Actor } from '@app/shared/actor/actor.model'
export class UserNotification implements UserNotificationServer {
id: number
read: boolean
video?: VideoInfo & {
- channel: {
- id: number
- displayName: string
- }
+ channel: ActorInfo & { avatarUrl?: string }
}
videoImport?: {
comment?: {
id: number
threadId: number
- account: {
- id: number
- displayName: string
- }
+ account: ActorInfo & { avatarUrl?: string }
video: VideoInfo
}
video: VideoInfo
}
- account?: {
- id: number
- displayName: string
- name: string
- }
+ account?: ActorInfo & { avatarUrl?: string }
actorFollow?: {
id: number
- follower: {
- name: string
- displayName: string
- }
+ follower: ActorInfo & { avatarUrl?: string }
following: {
type: 'account' | 'channel'
name: string
this.read = hash.read
this.video = hash.video
+ if (this.video) this.setAvatarUrl(this.video.channel)
+
this.videoImport = hash.videoImport
+
this.comment = hash.comment
+ if (this.comment) this.setAvatarUrl(this.comment.account)
+
this.videoAbuse = hash.videoAbuse
+
this.videoBlacklist = hash.videoBlacklist
+
this.account = hash.account
+ if (this.account) this.setAvatarUrl(this.account)
+
this.actorFollow = hash.actorFollow
+ if (this.actorFollow) this.setAvatarUrl(this.actorFollow.follower)
this.createdAt = hash.createdAt
this.updatedAt = hash.updatedAt
return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName
}
+ private setAvatarUrl (actor: { avatarUrl?: string, avatar?: { path: string } }) {
+ actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor)
+ }
}