diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-13 13:35:10 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-13 13:35:10 +0100 |
commit | 29c6b829446a6fb29dffc6b7b638079ce60f3771 (patch) | |
tree | 5ab1e2d80cd57caa87b9c29c514000fd06faad49 | |
parent | d6bd50ba1d095d35ec3837afedd8319a05cded90 (diff) | |
download | PeerTube-29c6b829446a6fb29dffc6b7b638079ce60f3771.tar.gz PeerTube-29c6b829446a6fb29dffc6b7b638079ce60f3771.tar.zst PeerTube-29c6b829446a6fb29dffc6b7b638079ce60f3771.zip |
Fix deleting a video with comments
-rw-r--r-- | server/models/video/video-comment.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 868d04ff9..ab0f05d6e 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -188,6 +188,27 @@ export class VideoCommentModel extends Model<VideoCommentModel> { | |||
188 | }) as AccountModel | 188 | }) as AccountModel |
189 | } | 189 | } |
190 | 190 | ||
191 | if (!instance.Video) { | ||
192 | instance.Video = await instance.$get('Video', { | ||
193 | include: [ | ||
194 | { | ||
195 | model: VideoChannelModel, | ||
196 | include: [ | ||
197 | { | ||
198 | model: AccountModel, | ||
199 | include: [ | ||
200 | { | ||
201 | model: ActorModel | ||
202 | } | ||
203 | ] | ||
204 | } | ||
205 | ] | ||
206 | } | ||
207 | ], | ||
208 | transaction: options.transaction | ||
209 | }) as VideoModel | ||
210 | } | ||
211 | |||
191 | if (instance.isOwned()) { | 212 | if (instance.isOwned()) { |
192 | await sendDeleteVideoComment(instance, options.transaction) | 213 | await sendDeleteVideoComment(instance, options.transaction) |
193 | } | 214 | } |