X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Faccount.ts;h=396959352c3792b9bae35f80f9e68e475e9f1cf7;hb=f89189907bbdff6c4bc6d3460ed9ef4c49515f17;hp=5bf29f45a8a15f5ad6ca8eefeec6f9c17e1ba3c2;hpb=866b5d3f5230204d611a556260102996c1aefe10;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 5bf29f45a..396959352 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -28,8 +28,9 @@ import { MAccountAP, MAccountDefault, MAccountFormattable, + MAccountHost, MAccountSummaryFormattable, - MChannelActor + MChannelHost } from '../../types/models' import { ActorModel } from '../actor/actor' import { ActorFollowModel } from '../actor/actor-follow' @@ -37,8 +38,8 @@ import { ActorImageModel } from '../actor/actor-image' import { ApplicationModel } from '../application/application' import { ServerModel } from '../server/server' import { ServerBlocklistModel } from '../server/server-blocklist' -import { UserModel } from '../user/user' import { buildSQLAttributes, getSort, throwIfNotValid } from '../shared' +import { UserModel } from '../user/user' import { VideoModel } from '../video/video' import { VideoChannelModel } from '../video/video-channel' import { VideoCommentModel } from '../video/video-comment' @@ -296,9 +297,7 @@ export class AccountModel extends Model>> { { model: ActorModel, required: true, - where: { - preferredUsername: name - } + where: ActorModel.wherePreferredUsername(name) } ] } @@ -321,9 +320,7 @@ export class AccountModel extends Model>> { { model: ActorModel, required: true, - where: { - preferredUsername: name - }, + where: ActorModel.wherePreferredUsername(name), include: [ { model: ServerModel, @@ -414,10 +411,6 @@ export class AccountModel extends Model>> { .findAll(query) } - getClientUrl () { - return WEBSERVER.URL + '/accounts/' + this.Actor.getIdentifier() - } - toFormattedJSON (this: MAccountFormattable): Account { return { ...this.Actor.toFormattedJSON(), @@ -467,8 +460,9 @@ export class AccountModel extends Model>> { return this.name } - getLocalUrl (this: MAccountActor | MChannelActor) { - return WEBSERVER.URL + `/accounts/` + this.Actor.preferredUsername + // Avoid error when running this method on MAccount... | MChannel... + getClientUrl (this: MAccountHost | MChannelHost) { + return WEBSERVER.URL + '/a/' + this.Actor.getIdentifier() } isBlocked () {