From 38967f7b73cec6f6198c72d62f8d64bb88e6951c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Jan 2019 13:52:46 +0100 Subject: Add server host in notification account field --- server/models/account/user-notification.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'server/models') diff --git a/server/models/account/user-notification.ts b/server/models/account/user-notification.ts index 1094eec78..6cdbb827b 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 } ] } @@ -132,6 +138,11 @@ function buildAccountInclude (required: boolean, withActor = false) { attributes: [ 'filename' ], model: () => AvatarModel.unscoped(), required: false + }, + { + attributes: [ 'host' ], + model: () => ServerModel.unscoped(), + required: false } ] }, @@ -411,7 +422,8 @@ export class UserNotificationModel extends Model { 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 +465,7 @@ export class UserNotificationModel extends Model { id: accountOrChannel.id, displayName: accountOrChannel.getDisplayName(), name: accountOrChannel.Actor.preferredUsername, + host: accountOrChannel.Actor.getHost(), avatar } } -- cgit v1.2.3