Add server host in notification account field

pull/1567/head
Chocobozzz 2019-01-21 13:52:46 +01:00
parent cfeae291c0
commit 38967f7b73
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 19 additions and 4 deletions

View File

@ -30,7 +30,7 @@
<footer class="row"> <footer class="row">
<a href="https://joinpeertube.org" title="PeerTube website" target="_blank" rel="noopener noreferrer">PeerTube v{{ serverVersion }}{{ serverCommit }}</a>&nbsp;-&nbsp; <a href="https://joinpeertube.org" title="PeerTube website" target="_blank" rel="noopener noreferrer">PeerTube v{{ serverVersion }}{{ serverCommit }}</a>&nbsp;-&nbsp;
<a href="https://github.com/Chocobozzz/PeerTube/blob/develop/LICENSE" title="PeerTube license" target="_blank" rel="noopener noreferrer">CopyLeft 2015-2018</a> <a href="https://github.com/Chocobozzz/PeerTube/blob/develop/LICENSE" title="PeerTube license" target="_blank" rel="noopener noreferrer">CopyLeft 2015-2019</a>
</footer> </footer>
</div> </div>
</div> </div>

View File

@ -136,8 +136,8 @@ export class UserNotification implements UserNotificationServer {
return '/videos/watch/' + video.uuid return '/videos/watch/' + video.uuid
} }
private buildAccountUrl (account: { name: string }) { private buildAccountUrl (account: { name: string, host: string }) {
return '/accounts/' + account.name return '/accounts/' + Actor.CREATE_BY_STRING(account.name, account.host)
} }
private buildVideoImportUrl () { private buildVideoImportUrl () {

View File

@ -28,6 +28,7 @@ import { VideoImportModel } from '../video/video-import'
import { ActorModel } from '../activitypub/actor' import { ActorModel } from '../activitypub/actor'
import { ActorFollowModel } from '../activitypub/actor-follow' import { ActorFollowModel } from '../activitypub/actor-follow'
import { AvatarModel } from '../avatar/avatar' import { AvatarModel } from '../avatar/avatar'
import { ServerModel } from '../server/server'
enum ScopeNames { enum ScopeNames {
WITH_ALL = 'WITH_ALL' WITH_ALL = 'WITH_ALL'
@ -43,6 +44,11 @@ function buildActorWithAvatarInclude () {
attributes: [ 'filename' ], attributes: [ 'filename' ],
model: () => AvatarModel.unscoped(), model: () => AvatarModel.unscoped(),
required: false required: false
},
{
attributes: [ 'host' ],
model: () => ServerModel.unscoped(),
required: false
} }
] ]
} }
@ -132,6 +138,11 @@ function buildAccountInclude (required: boolean, withActor = false) {
attributes: [ 'filename' ], attributes: [ 'filename' ],
model: () => AvatarModel.unscoped(), model: () => AvatarModel.unscoped(),
required: false required: false
},
{
attributes: [ 'host' ],
model: () => ServerModel.unscoped(),
required: false
} }
] ]
}, },
@ -411,7 +422,8 @@ export class UserNotificationModel extends Model<UserNotificationModel> {
id: this.ActorFollow.ActorFollower.Account.id, id: this.ActorFollow.ActorFollower.Account.id,
displayName: this.ActorFollow.ActorFollower.Account.getDisplayName(), displayName: this.ActorFollow.ActorFollower.Account.getDisplayName(),
name: this.ActorFollow.ActorFollower.preferredUsername, 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: { following: {
type: this.ActorFollow.ActorFollowing.VideoChannel ? 'channel' as 'channel' : 'account' as 'account', type: this.ActorFollow.ActorFollowing.VideoChannel ? 'channel' as 'channel' : 'account' as 'account',
@ -453,6 +465,7 @@ export class UserNotificationModel extends Model<UserNotificationModel> {
id: accountOrChannel.id, id: accountOrChannel.id,
displayName: accountOrChannel.getDisplayName(), displayName: accountOrChannel.getDisplayName(),
name: accountOrChannel.Actor.preferredUsername, name: accountOrChannel.Actor.preferredUsername,
host: accountOrChannel.Actor.getHost(),
avatar avatar
} }
} }

View File

@ -26,6 +26,7 @@ export interface ActorInfo {
id: number id: number
displayName: string displayName: string
name: string name: string
host: string
avatar?: { avatar?: {
path: string path: string
} }

View File

@ -146,6 +146,7 @@ function checkVideo (video: any, videoName?: string, videoUUID?: string) {
function checkActor (actor: any) { function checkActor (actor: any) {
expect(actor.displayName).to.be.a('string') expect(actor.displayName).to.be.a('string')
expect(actor.displayName).to.not.be.empty expect(actor.displayName).to.not.be.empty
expect(actor.host).to.not.be.undefined
} }
function checkComment (comment: any, commentId: number, threadId: number) { function checkComment (comment: any, commentId: number, threadId: number) {