X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Faccount.ts;h=619a598ddf15013d2d1eb34796c2280dedbb36d5;hb=21d68e68039a1eefbe6213fbde46e737e520ee7d;hp=37194a119bb85b6ff1ecbc8d3919c25e8f1c7f4e;hpb=fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 37194a119..619a598dd 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -17,7 +17,7 @@ import { UpdatedAt } from 'sequelize-typescript' import { ModelCache } from '@server/models/model-cache' -import { AttributesOnly } from '@shared/core-utils' +import { AttributesOnly } from '@shared/typescript-utils' import { Account, AccountSummary } from '../../../shared/models/actors' import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts' import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants' @@ -99,7 +99,7 @@ export type SummaryOptions = { queryInclude.push({ attributes: [ 'id' ], model: AccountBlocklistModel.unscoped(), - as: 'BlockedAccounts', + as: 'BlockedBy', required: false, where: { accountId: { @@ -228,10 +228,10 @@ export class AccountModel extends Model>> { name: 'targetAccountId', allowNull: false }, - as: 'BlockedAccounts', + as: 'BlockedBy', onDelete: 'CASCADE' }) - BlockedAccounts: AccountBlocklistModel[] + BlockedBy: AccountBlocklistModel[] @BeforeDestroy static async sendDeleteIfOwned (instance: AccountModel, options) { @@ -457,6 +457,6 @@ export class AccountModel extends Model>> { } isBlocked () { - return this.BlockedAccounts && this.BlockedAccounts.length !== 0 + return this.BlockedBy && this.BlockedBy.length !== 0 } }