aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-30 13:39:20 +0200
committerChocobozzz <me@florianbigard.com>2018-07-30 13:39:20 +0200
commitc5a893d5363ce1fd681751cf48977086a35d5724 (patch)
treebeeb87ea2c8309b43118bc45d48ff09f38b42ea9 /server/models/activitypub
parentb7f5b524756e8a30c396ae40a262884766ef6554 (diff)
downloadPeerTube-c5a893d5363ce1fd681751cf48977086a35d5724.tar.gz
PeerTube-c5a893d5363ce1fd681751cf48977086a35d5724.tar.zst
PeerTube-c5a893d5363ce1fd681751cf48977086a35d5724.zip
Revert "Delete actor too when deleting account/video channel"
This reverts commit e04551d796adf69703a41af123207b2624237292. See https://github.com/Chocobozzz/PeerTube/issues/870#issuecomment-408814420
Diffstat (limited to 'server/models/activitypub')
-rw-r--r--server/models/activitypub/actor.ts25
1 files changed, 8 insertions, 17 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index f231dba74..267032e2a 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -3,7 +3,6 @@ import { extname } from 'path'
3import * as Sequelize from 'sequelize' 3import * as Sequelize from 'sequelize'
4import { 4import {
5 AllowNull, 5 AllowNull,
6 BeforeDestroy,
7 BelongsTo, 6 BelongsTo,
8 Column, 7 Column,
9 CreatedAt, 8 CreatedAt,
@@ -38,8 +37,6 @@ import { ServerModel } from '../server/server'
38import { throwIfNotValid } from '../utils' 37import { throwIfNotValid } from '../utils'
39import { VideoChannelModel } from '../video/video-channel' 38import { VideoChannelModel } from '../video/video-channel'
40import { ActorFollowModel } from './actor-follow' 39import { ActorFollowModel } from './actor-follow'
41import { logger } from '../../helpers/logger'
42import { sendDeleteActor } from '../../lib/activitypub/send'
43 40
44enum ScopeNames { 41enum ScopeNames {
45 FULL = 'FULL' 42 FULL = 'FULL'
@@ -227,28 +224,22 @@ export class ActorModel extends Model<ActorModel> {
227 224
228 @HasOne(() => AccountModel, { 225 @HasOne(() => AccountModel, {
229 foreignKey: { 226 foreignKey: {
230 allowNull: false 227 allowNull: true
231 } 228 },
229 onDelete: 'cascade',
230 hooks: true
232 }) 231 })
233 Account: AccountModel 232 Account: AccountModel
234 233
235 @HasOne(() => VideoChannelModel, { 234 @HasOne(() => VideoChannelModel, {
236 foreignKey: { 235 foreignKey: {
237 allowNull: false 236 allowNull: true
238 } 237 },
238 onDelete: 'cascade',
239 hooks: true
239 }) 240 })
240 VideoChannel: VideoChannelModel 241 VideoChannel: VideoChannelModel
241 242
242 @BeforeDestroy
243 static async sendDeleteIfOwned (instance: ActorModel, options) {
244 if (instance.isOwned()) {
245 logger.debug('Sending delete of actor %s.', instance.url)
246 return sendDeleteActor(instance, options.transaction)
247 }
248
249 return undefined
250 }
251
252 static load (id: number) { 243 static load (id: number) {
253 return ActorModel.unscoped().findById(id) 244 return ActorModel.unscoped().findById(id)
254 } 245 }