aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/user-notification.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/account/user-notification.ts')
-rw-r--r--server/models/account/user-notification.ts19
1 files changed, 15 insertions, 4 deletions
diff --git a/server/models/account/user-notification.ts b/server/models/account/user-notification.ts
index 9b13a8376..ccb81b891 100644
--- a/server/models/account/user-notification.ts
+++ b/server/models/account/user-notification.ts
@@ -135,13 +135,18 @@ function buildAccountInclude (required: boolean, withActor = false) {
135 ] 135 ]
136 }, 136 },
137 { 137 {
138 attributes: [ 'preferredUsername' ], 138 attributes: [ 'preferredUsername', 'type' ],
139 model: ActorModel.unscoped(), 139 model: ActorModel.unscoped(),
140 required: true, 140 required: true,
141 as: 'ActorFollowing', 141 as: 'ActorFollowing',
142 include: [ 142 include: [
143 buildChannelInclude(false), 143 buildChannelInclude(false),
144 buildAccountInclude(false) 144 buildAccountInclude(false),
145 {
146 attributes: [ 'host' ],
147 model: ServerModel.unscoped(),
148 required: false
149 }
145 ] 150 ]
146 } 151 }
147 ] 152 ]
@@ -404,6 +409,11 @@ export class UserNotificationModel extends Model<UserNotificationModel> {
404 409
405 const account = this.Account ? this.formatActor(this.Account) : undefined 410 const account = this.Account ? this.formatActor(this.Account) : undefined
406 411
412 const actorFollowingType = {
413 Application: 'instance' as 'instance',
414 Group: 'channel' as 'channel',
415 Person: 'account' as 'account'
416 }
407 const actorFollow = this.ActorFollow ? { 417 const actorFollow = this.ActorFollow ? {
408 id: this.ActorFollow.id, 418 id: this.ActorFollow.id,
409 state: this.ActorFollow.state, 419 state: this.ActorFollow.state,
@@ -415,9 +425,10 @@ export class UserNotificationModel extends Model<UserNotificationModel> {
415 host: this.ActorFollow.ActorFollower.getHost() 425 host: this.ActorFollow.ActorFollower.getHost()
416 }, 426 },
417 following: { 427 following: {
418 type: this.ActorFollow.ActorFollowing.VideoChannel ? 'channel' as 'channel' : 'account' as 'account', 428 type: actorFollowingType[this.ActorFollow.ActorFollowing.type],
419 displayName: (this.ActorFollow.ActorFollowing.VideoChannel || this.ActorFollow.ActorFollowing.Account).getDisplayName(), 429 displayName: (this.ActorFollow.ActorFollowing.VideoChannel || this.ActorFollow.ActorFollowing.Account).getDisplayName(),
420 name: this.ActorFollow.ActorFollowing.preferredUsername 430 name: this.ActorFollow.ActorFollowing.preferredUsername,
431 host: this.ActorFollow.ActorFollowing.getHost()
421 } 432 }
422 } : undefined 433 } : undefined
423 434