X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Fuser-notification.ts;h=33480f3b585b205be6040623bcd3bb8dd7386aab;hb=e8bafea35bc930cb8ac5b2d521a188642a1adffe;hp=1094eec7883dd76238e0dfe4830b62084ecbc549;hpb=457bb213b273a9b206cc5654eb085cede4e916ad;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/user-notification.ts b/server/models/account/user-notification.ts index 1094eec78..33480f3b5 100644 --- a/server/models/account/user-notification.ts +++ b/server/models/account/user-notification.ts @@ -28,6 +28,7 @@ import { VideoImportModel } from '../video/video-import' import { ActorModel } from '../activitypub/actor' import { ActorFollowModel } from '../activitypub/actor-follow' import { AvatarModel } from '../avatar/avatar' +import { ServerModel } from '../server/server' enum ScopeNames { WITH_ALL = 'WITH_ALL' @@ -43,6 +44,11 @@ function buildActorWithAvatarInclude () { attributes: [ 'filename' ], model: () => AvatarModel.unscoped(), required: false + }, + { + attributes: [ 'host' ], + model: () => ServerModel.unscoped(), + required: false } ] } @@ -113,7 +119,7 @@ function buildAccountInclude (required: boolean, withActor = false) { }, { - attributes: [ 'id' ], + attributes: [ 'id', 'state' ], model: () => ActorFollowModel.unscoped(), required: false, include: [ @@ -132,6 +138,11 @@ function buildAccountInclude (required: boolean, withActor = false) { attributes: [ 'filename' ], model: () => AvatarModel.unscoped(), required: false + }, + { + attributes: [ 'host' ], + model: () => ServerModel.unscoped(), + required: false } ] }, @@ -407,11 +418,13 @@ export class UserNotificationModel extends Model { const actorFollow = this.ActorFollow ? { id: this.ActorFollow.id, + state: this.ActorFollow.state, follower: { id: this.ActorFollow.ActorFollower.Account.id, displayName: this.ActorFollow.ActorFollower.Account.getDisplayName(), name: this.ActorFollow.ActorFollower.preferredUsername, - avatar: this.ActorFollow.ActorFollower.Avatar ? { path: this.ActorFollow.ActorFollower.Avatar.getWebserverPath() } : undefined + avatar: this.ActorFollow.ActorFollower.Avatar ? { path: this.ActorFollow.ActorFollower.Avatar.getWebserverPath() } : undefined, + host: this.ActorFollow.ActorFollower.getHost() }, following: { type: this.ActorFollow.ActorFollowing.VideoChannel ? 'channel' as 'channel' : 'account' as 'account', @@ -453,6 +466,7 @@ export class UserNotificationModel extends Model { id: accountOrChannel.id, displayName: accountOrChannel.getDisplayName(), name: accountOrChannel.Actor.preferredUsername, + host: accountOrChannel.Actor.getHost(), avatar } }