aboutsummaryrefslogtreecommitdiffhomepage
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
parentcfeae291c00812bb99e88bdec785792ae5d5934e (diff)
downloadPeerTube-38967f7b73cec6f6198c72d62f8d64bb88e6951c.tar.gz
PeerTube-38967f7b73cec6f6198c72d62f8d64bb88e6951c.tar.zst
PeerTube-38967f7b73cec6f6198c72d62f8d64bb88e6951c.zip
Add server host in notification account field
-rw-r--r--client/src/app/app.component.html2
-rw-r--r--client/src/app/shared/users/user-notification.model.ts4
-rw-r--r--server/models/account/user-notification.ts15
-rw-r--r--shared/models/users/user-notification.model.ts1
-rw-r--r--shared/utils/users/user-notifications.ts1
5 files changed, 19 insertions, 4 deletions
diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html
index dfda556f5..d398d4f35 100644
--- a/client/src/app/app.component.html
+++ b/client/src/app/app.component.html
@@ -30,7 +30,7 @@
30 30
31 <footer class="row"> 31 <footer class="row">
32 <a href="https://joinpeertube.org" title="PeerTube website" target="_blank" rel="noopener noreferrer">PeerTube v{{ serverVersion }}{{ serverCommit }}</a>&nbsp;-&nbsp; 32 <a href="https://joinpeertube.org" title="PeerTube website" target="_blank" rel="noopener noreferrer">PeerTube v{{ serverVersion }}{{ serverCommit }}</a>&nbsp;-&nbsp;
33 <a href="https://github.com/Chocobozzz/PeerTube/blob/develop/LICENSE" title="PeerTube license" target="_blank" rel="noopener noreferrer">CopyLeft 2015-2018</a> 33 <a href="https://github.com/Chocobozzz/PeerTube/blob/develop/LICENSE" title="PeerTube license" target="_blank" rel="noopener noreferrer">CopyLeft 2015-2019</a>
34 </footer> 34 </footer>
35 </div> 35 </div>
36 </div> 36 </div>
diff --git a/client/src/app/shared/users/user-notification.model.ts b/client/src/app/shared/users/user-notification.model.ts
index c5996a8a1..3bb53ff45 100644
--- a/client/src/app/shared/users/user-notification.model.ts
+++ b/client/src/app/shared/users/user-notification.model.ts
@@ -136,8 +136,8 @@ export class UserNotification implements UserNotificationServer {
136 return '/videos/watch/' + video.uuid 136 return '/videos/watch/' + video.uuid
137 } 137 }
138 138
139 private buildAccountUrl (account: { name: string }) { 139 private buildAccountUrl (account: { name: string, host: string }) {
140 return '/accounts/' + account.name 140 return '/accounts/' + Actor.CREATE_BY_STRING(account.name, account.host)
141 } 141 }
142 142
143 private buildVideoImportUrl () { 143 private buildVideoImportUrl () {
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 }
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts
index eaeb422df..186b62612 100644
--- a/shared/models/users/user-notification.model.ts
+++ b/shared/models/users/user-notification.model.ts
@@ -26,6 +26,7 @@ export interface ActorInfo {
26 id: number 26 id: number
27 displayName: string 27 displayName: string
28 name: string 28 name: string
29 host: string
29 avatar?: { 30 avatar?: {
30 path: string 31 path: string
31 } 32 }
diff --git a/shared/utils/users/user-notifications.ts b/shared/utils/users/user-notifications.ts
index bcbe29fc7..b85d5d2f1 100644
--- a/shared/utils/users/user-notifications.ts
+++ b/shared/utils/users/user-notifications.ts
@@ -146,6 +146,7 @@ function checkVideo (video: any, videoName?: string, videoUUID?: string) {
146function checkActor (actor: any) { 146function checkActor (actor: any) {
147 expect(actor.displayName).to.be.a('string') 147 expect(actor.displayName).to.be.a('string')
148 expect(actor.displayName).to.not.be.empty 148 expect(actor.displayName).to.not.be.empty
149 expect(actor.host).to.not.be.undefined
149} 150}
150 151
151function checkComment (comment: any, commentId: number, threadId: number) { 152function checkComment (comment: any, commentId: number, threadId: number) {