X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-channel.ts;h=5b50753445647923728d06df81c3f54c2bbb7b23;hb=cda03765fe366f028897e9b02dd4a0a19af3c935;hp=c077fb5184650461ab49cc48c06905ca1dc5cb55;hpb=07b1a18aa678d260009a93e36606c5c5f585723d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index c077fb518..5b5075344 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -8,7 +8,8 @@ import { Default, DefaultScope, ForeignKey, - HasMany, IFindOptions, + HasMany, + IFindOptions, Is, Model, Scopes, @@ -28,7 +29,7 @@ import { AccountModel, ScopeNames as AccountModelScopeNames } from '../account/a import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor' import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils' import { VideoModel } from './video' -import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' +import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants' import { ServerModel } from '../server/server' import { DefineIndexesOptions } from 'sequelize' import { AvatarModel } from '../avatar/avatar' @@ -67,9 +68,9 @@ type AvailableForListOptions = { ] }) @Scopes({ - [ScopeNames.SUMMARY]: (required: boolean, withAccount: boolean) => { + [ScopeNames.SUMMARY]: (withAccount = false) => { const base: IFindOptions = { - attributes: [ 'name', 'description', 'id' ], + attributes: [ 'name', 'description', 'id', 'actorId' ], include: [ { attributes: [ 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ], @@ -225,7 +226,7 @@ export class VideoChannelModel extends Model { foreignKey: { allowNull: true }, - onDelete: 'cascade', + onDelete: 'CASCADE', hooks: true }) VideoPlaylists: VideoPlaylistModel[] @@ -419,7 +420,7 @@ export class VideoChannelModel extends Model { static loadByNameWithHostAndPopulateAccount (nameWithHost: string) { const [ name, host ] = nameWithHost.split('@') - if (!host || host === CONFIG.WEBSERVER.HOST) return VideoChannelModel.loadLocalByNameAndPopulateAccount(name) + if (!host || host === WEBSERVER.HOST) return VideoChannelModel.loadLocalByNameAndPopulateAccount(name) return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host) }