aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-caption.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-15 09:17:19 +0200
committerChocobozzz <me@florianbigard.com>2021-06-15 10:40:06 +0200
commiteae0365b5c5468e51e9795b0e894815ebda86b4a (patch)
tree5da54b28c94d43d1715a0c69e35eb1cf3a1a959d /server/models/video/video-caption.ts
parent51f636ad0f928bb94069c9143e38df0518f6e4a7 (diff)
downloadPeerTube-eae0365b5c5468e51e9795b0e894815ebda86b4a.tar.gz
PeerTube-eae0365b5c5468e51e9795b0e894815ebda86b4a.tar.zst
PeerTube-eae0365b5c5468e51e9795b0e894815ebda86b4a.zip
Fix missing transactions
Diffstat (limited to 'server/models/video/video-caption.ts')
-rw-r--r--server/models/video/video-caption.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts
index bbda0f3ee..5ec944b9e 100644
--- a/server/models/video/video-caption.ts
+++ b/server/models/video/video-caption.ts
@@ -91,9 +91,9 @@ export class VideoCaptionModel extends Model<Partial<AttributesOnly<VideoCaption
91 Video: VideoModel 91 Video: VideoModel
92 92
93 @BeforeDestroy 93 @BeforeDestroy
94 static async removeFiles (instance: VideoCaptionModel) { 94 static async removeFiles (instance: VideoCaptionModel, options) {
95 if (!instance.Video) { 95 if (!instance.Video) {
96 instance.Video = await instance.$get('Video') 96 instance.Video = await instance.$get('Video', { transaction: options.transaction })
97 } 97 }
98 98
99 if (instance.isOwned()) { 99 if (instance.isOwned()) {
@@ -113,8 +113,7 @@ export class VideoCaptionModel extends Model<Partial<AttributesOnly<VideoCaption
113 const videoInclude = { 113 const videoInclude = {
114 model: VideoModel.unscoped(), 114 model: VideoModel.unscoped(),
115 attributes: [ 'id', 'remote', 'uuid' ], 115 attributes: [ 'id', 'remote', 'uuid' ],
116 where: buildWhereIdOrUUID(videoId), 116 where: buildWhereIdOrUUID(videoId)
117 transaction
118 } 117 }
119 118
120 const query = { 119 const query = {
@@ -123,7 +122,8 @@ export class VideoCaptionModel extends Model<Partial<AttributesOnly<VideoCaption
123 }, 122 },
124 include: [ 123 include: [
125 videoInclude 124 videoInclude
126 ] 125 ],
126 transaction
127 } 127 }
128 128
129 return VideoCaptionModel.findOne(query) 129 return VideoCaptionModel.findOne(query)