aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-21 13:52:46 +0100
committerChocobozzz <me@florianbigard.com>2019-01-21 13:52:46 +0100
commit38967f7b73cec6f6198c72d62f8d64bb88e6951c (patch)
treeb1f9d308dfb600cde1559ddf6ac13294020d45fa /server/models
parentcfeae291c00812bb99e88bdec785792ae5d5934e (diff)
downloadPeerTube-38967f7b73cec6f6198c72d62f8d64bb88e6951c.tar.gz
PeerTube-38967f7b73cec6f6198c72d62f8d64bb88e6951c.tar.zst
PeerTube-38967f7b73cec6f6198c72d62f8d64bb88e6951c.zip
Add server host in notification account field
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/user-notification.ts15
1 files changed, 14 insertions, 1 deletions
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'
28import { ActorModel } from '../activitypub/actor' 28import { ActorModel } from '../activitypub/actor'
29import { ActorFollowModel } from '../activitypub/actor-follow' 29import { ActorFollowModel } from '../activitypub/actor-follow'
30import { AvatarModel } from '../avatar/avatar' 30import { AvatarModel } from '../avatar/avatar'
31import { ServerModel } from '../server/server'
31 32
32enum ScopeNames { 33enum ScopeNames {
33 WITH_ALL = 'WITH_ALL' 34 WITH_ALL = 'WITH_ALL'
@@ -43,6 +44,11 @@ function buildActorWithAvatarInclude () {
43 attributes: [ 'filename' ], 44 attributes: [ 'filename' ],
44 model: () => AvatarModel.unscoped(), 45 model: () => AvatarModel.unscoped(),
45 required: false 46 required: false
47 },
48 {
49 attributes: [ 'host' ],
50 model: () => ServerModel.unscoped(),
51 required: false
46 } 52 }
47 ] 53 ]
48 } 54 }
@@ -132,6 +138,11 @@ function buildAccountInclude (required: boolean, withActor = false) {
132 attributes: [ 'filename' ], 138 attributes: [ 'filename' ],
133 model: () => AvatarModel.unscoped(), 139 model: () => AvatarModel.unscoped(),
134 required: false 140 required: false
141 },
142 {
143 attributes: [ 'host' ],
144 model: () => ServerModel.unscoped(),
145 required: false
135 } 146 }
136 ] 147 ]
137 }, 148 },
@@ -411,7 +422,8 @@ export class UserNotificationModel extends Model<UserNotificationModel> {
411 id: this.ActorFollow.ActorFollower.Account.id, 422 id: this.ActorFollow.ActorFollower.Account.id,
412 displayName: this.ActorFollow.ActorFollower.Account.getDisplayName(), 423 displayName: this.ActorFollow.ActorFollower.Account.getDisplayName(),
413 name: this.ActorFollow.ActorFollower.preferredUsername, 424 name: this.ActorFollow.ActorFollower.preferredUsername,
414 avatar: this.ActorFollow.ActorFollower.Avatar ? { path: this.ActorFollow.ActorFollower.Avatar.getWebserverPath() } : undefined 425 avatar: this.ActorFollow.ActorFollower.Avatar ? { path: this.ActorFollow.ActorFollower.Avatar.getWebserverPath() } : undefined,
426 host: this.ActorFollow.ActorFollower.getHost()
415 }, 427 },
416 following: { 428 following: {
417 type: this.ActorFollow.ActorFollowing.VideoChannel ? 'channel' as 'channel' : 'account' as 'account', 429 type: this.ActorFollow.ActorFollowing.VideoChannel ? 'channel' as 'channel' : 'account' as 'account',
@@ -453,6 +465,7 @@ export class UserNotificationModel extends Model<UserNotificationModel> {
453 id: accountOrChannel.id, 465 id: accountOrChannel.id,
454 displayName: accountOrChannel.getDisplayName(), 466 displayName: accountOrChannel.getDisplayName(),
455 name: accountOrChannel.Actor.preferredUsername, 467 name: accountOrChannel.Actor.preferredUsername,
468 host: accountOrChannel.Actor.getHost(),
456 avatar 469 avatar
457 } 470 }
458 } 471 }