aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-comment.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-18 10:53:54 +0100
committerChocobozzz <me@florianbigard.com>2018-01-18 15:42:20 +0100
commitf05a1c30c15d2ae35c11e241ca039a72eeb7d6ad (patch)
tree6d90c0de5dd3ad506e738d447e4f396951ed5624 /server/models/video/video-comment.ts
parent1174a8479ab9ee47b3305d668fe757435057a298 (diff)
downloadPeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.tar.gz
PeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.tar.zst
PeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.zip
Don't show videos of remote instance after unfollow
Diffstat (limited to 'server/models/video/video-comment.ts')
-rw-r--r--server/models/video/video-comment.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index c10d7c7c8..ab909b0b8 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -1,6 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { 2import {
3 AfterDestroy, AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, IFindOptions, Is, Model, Scopes, Table, 3 AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DataType, ForeignKey, IFindOptions, Is, Model, Scopes, Table,
4 UpdatedAt 4 UpdatedAt
5} from 'sequelize-typescript' 5} from 'sequelize-typescript'
6import { ActivityTagObject } from '../../../shared/models/activitypub/objects/common-objects' 6import { ActivityTagObject } from '../../../shared/models/activitypub/objects/common-objects'
@@ -175,10 +175,17 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
175 }) 175 })
176 Account: AccountModel 176 Account: AccountModel
177 177
178 @AfterDestroy 178 @BeforeDestroy
179 static async sendDeleteIfOwned (instance: VideoCommentModel) { 179 static async sendDeleteIfOwned (instance: VideoCommentModel, options) {
180 if (!instance.Account || !instance.Account.Actor) {
181 instance.Account = await instance.$get('Account', {
182 include: [ ActorModel ],
183 transaction: options.transaction
184 }) as AccountModel
185 }
186
180 if (instance.isOwned()) { 187 if (instance.isOwned()) {
181 await sendDeleteVideoComment(instance, undefined) 188 await sendDeleteVideoComment(instance, options.transaction)
182 } 189 }
183 } 190 }
184 191