X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-channel.ts;h=4e98e7ba3f064333176f8a30c2e87c98365c7518;hb=0374b6b5cd685316f924874b2a3068bb345eb0dd;hp=7178631b47119ee3efc251255b11fcda5bdaa4bc;hpb=282e61e6c11f79e919c543871783fe1a00298d18;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 7178631b4..4e98e7ba3 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -43,18 +43,6 @@ import { MChannelSummaryFormattable } from '../../typings/models/video' -// FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation -const indexes: ModelIndexesOptions[] = [ - buildTrigramSearchIndex('video_channel_name_trigram', 'name'), - - { - fields: [ 'accountId' ] - }, - { - fields: [ 'actorId' ] - } -] - export enum ScopeNames { FOR_API = 'FOR_API', WITH_ACCOUNT = 'WITH_ACCOUNT', @@ -176,7 +164,16 @@ export type SummaryOptions = { })) @Table({ tableName: 'videoChannel', - indexes + indexes: [ + buildTrigramSearchIndex('video_channel_name_trigram', 'name'), + + { + fields: [ 'accountId' ] + }, + { + fields: [ 'actorId' ] + } + ] }) export class VideoChannelModel extends Model { @@ -249,7 +246,7 @@ export class VideoChannelModel extends Model { @BeforeDestroy static async sendDeleteIfOwned (instance: VideoChannelModel, options) { if (!instance.Actor) { - instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel + instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) } if (instance.Actor.isOwned()) { @@ -517,7 +514,7 @@ export class VideoChannelModel extends Model { } toActivityPubObject (this: MChannelAP): ActivityPubActor { - const obj = this.Actor.toActivityPubObject(this.name, 'VideoChannel') + const obj = this.Actor.toActivityPubObject(this.name) return Object.assign(obj, { summary: this.description,