X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-main%2Fusers%2Fuser-notification.model.ts;h=d1b36f3473a6599e2fc9c3bf19f4f7a28a168327;hb=1808a1f8e4b7b102823492a2007a46929aebf189;hp=1211995fd3a89e98ce3e02b43d9e9362f55d4df9;hpb=69524f6ed170c74fab8d5833920c389fde992f3e;p=github%2FChocobozzz%2FPeerTube.git 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 1211995fd..d1b36f347 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 @@ -6,11 +6,13 @@ import { AbuseState, ActorInfo, FollowState, + PluginType, UserNotification as UserNotificationServer, UserNotificationType, UserRight, VideoInfo } from '@shared/models' +import { Video } from '../video' export class UserNotification implements UserNotificationServer { id: number @@ -45,11 +47,7 @@ export class UserNotification implements UserNotificationServer { comment?: { threadId: number - video: { - id: number - uuid: string - name: string - } + video: VideoInfo } account?: ActorInfo @@ -74,20 +72,40 @@ export class UserNotification implements UserNotificationServer { } } + plugin?: { + name: string + type: PluginType + latestVersion: string + } + + peertube?: { + latestVersion: string + } + createdAt: string updatedAt: string // Additional fields videoUrl?: string commentUrl?: any[] + abuseUrl?: string abuseQueryParams?: { [id: string]: string } = {} + videoAutoBlacklistUrl?: string + accountUrl?: string + videoImportIdentifier?: string videoImportUrl?: string + instanceFollowUrl?: string + peertubeVersionLink?: string + + pluginUrl?: string + pluginQueryParams?: { [id: string]: string } = {} + constructor (hash: UserNotificationServer, user: AuthUser) { this.id = hash.id this.type = hash.type @@ -114,6 +132,9 @@ export class UserNotification implements UserNotificationServer { this.actorFollow = hash.actorFollow if (this.actorFollow) this.setAccountAvatarUrl(this.actorFollow.follower) + this.plugin = hash.plugin + this.peertube = hash.peertube + this.createdAt = hash.createdAt this.updatedAt = hash.updatedAt @@ -197,6 +218,19 @@ export class UserNotification implements UserNotificationServer { case UserNotificationType.AUTO_INSTANCE_FOLLOWING: this.instanceFollowUrl = '/admin/follows/following-list' break + + case UserNotificationType.NEW_PEERTUBE_VERSION: + this.peertubeVersionLink = 'https://joinpeertube.org/news' + break + + case UserNotificationType.NEW_PLUGIN_VERSION: + this.pluginUrl = `/admin/plugins/list-installed` + this.pluginQueryParams.pluginType = this.plugin.type + '' + break + + case UserNotificationType.MY_VIDEO_EDITION_FINISHED: + this.videoUrl = this.buildVideoUrl(this.video) + break } } catch (err) { this.type = null @@ -205,11 +239,11 @@ export class UserNotification implements UserNotificationServer { } private buildVideoUrl (video: { uuid: string }) { - return '/videos/watch/' + video.uuid + return Video.buildWatchUrl(video) } private buildAccountUrl (account: { name: string, host: string }) { - return '/accounts/' + Actor.CREATE_BY_STRING(account.name, account.host) + return '/a/' + Actor.CREATE_BY_STRING(account.name, account.host) } private buildVideoImportUrl () { @@ -224,11 +258,11 @@ export class UserNotification implements UserNotificationServer { return [ this.buildVideoUrl(comment.video), { threadId: comment.threadId } ] } - private setAccountAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { - actor.avatarUrl = Account.GET_ACTOR_AVATAR_URL(actor) + private setAccountAvatarUrl (actor: { avatarUrl?: string, avatars: { width: number, url?: string, path: string }[] }) { + actor.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(actor, 48) || Account.GET_DEFAULT_AVATAR_URL(48) } - private setVideoChannelAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { - actor.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(actor) + private setVideoChannelAvatarUrl (actor: { avatarUrl?: string, avatars: { width: number, url?: string, path: string }[] }) { + actor.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(actor, 48) || VideoChannel.GET_DEFAULT_AVATAR_URL(48) } }