aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r--server/models/video/video-channel.ts23
1 files changed, 13 insertions, 10 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 9da965bbc..202dc513f 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -1,3 +1,5 @@
1import * as Bluebird from 'bluebird'
2import { FindOptions, literal, Op, ScopeOptions } from 'sequelize'
1import { 3import {
2 AllowNull, 4 AllowNull,
3 BeforeDestroy, 5 BeforeDestroy,
@@ -23,17 +25,8 @@ import {
23 isVideoChannelNameValid, 25 isVideoChannelNameValid,
24 isVideoChannelSupportValid 26 isVideoChannelSupportValid
25} from '../../helpers/custom-validators/video-channels' 27} from '../../helpers/custom-validators/video-channels'
26import { sendDeleteActor } from '../../lib/activitypub/send'
27import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account'
28import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
29import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils'
30import { VideoModel } from './video'
31import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants' 28import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
32import { ServerModel } from '../server/server' 29import { sendDeleteActor } from '../../lib/activitypub/send'
33import { FindOptions, Op, literal, ScopeOptions } from 'sequelize'
34import { AvatarModel } from '../avatar/avatar'
35import { VideoPlaylistModel } from './video-playlist'
36import * as Bluebird from 'bluebird'
37import { 30import {
38 MChannelAccountDefault, 31 MChannelAccountDefault,
39 MChannelActor, 32 MChannelActor,
@@ -42,6 +35,14 @@ import {
42 MChannelFormattable, 35 MChannelFormattable,
43 MChannelSummaryFormattable 36 MChannelSummaryFormattable
44} from '../../types/models/video' 37} from '../../types/models/video'
38import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account'
39import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
40import { ActorFollowModel } from '../activitypub/actor-follow'
41import { AvatarModel } from '../avatar/avatar'
42import { ServerModel } from '../server/server'
43import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils'
44import { VideoModel } from './video'
45import { VideoPlaylistModel } from './video-playlist'
45 46
46export enum ScopeNames { 47export enum ScopeNames {
47 FOR_API = 'FOR_API', 48 FOR_API = 'FOR_API',
@@ -293,6 +294,8 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
293 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) 294 instance.Actor = await instance.$get('Actor', { transaction: options.transaction })
294 } 295 }
295 296
297 await ActorFollowModel.removeFollowsOf(instance.Actor.id, options.transaction)
298
296 if (instance.Actor.isOwned()) { 299 if (instance.Actor.isOwned()) {
297 return sendDeleteActor(instance.Actor, options.transaction) 300 return sendDeleteActor(instance.Actor, options.transaction)
298 } 301 }