aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/rate.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-30 11:31:15 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-30 11:31:15 +0100
commit25ed141c7c7631ef21d8764c1163fbf8a6591391 (patch)
tree8f556181a3369e7e4938d612d91be0af813e5067 /server/controllers/api/videos/rate.ts
parent5cd80545422bba855cc9a730a2e13cc9d982c34b (diff)
downloadPeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.tar.gz
PeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.tar.zst
PeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.zip
Put activity pub sends inside transactions
Diffstat (limited to 'server/controllers/api/videos/rate.ts')
-rw-r--r--server/controllers/api/videos/rate.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index 0c6a988cf..c27c61116 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -58,11 +58,11 @@ async function rateVideo (req: express.Request, res: express.Response) {
58 else if (previousRate.type === VIDEO_RATE_TYPES.DISLIKE) dislikesToIncrement-- 58 else if (previousRate.type === VIDEO_RATE_TYPES.DISLIKE) dislikesToIncrement--
59 59
60 if (rateType === 'none') { // Destroy previous rate 60 if (rateType === 'none') { // Destroy previous rate
61 await previousRate.destroy() 61 await previousRate.destroy({ transaction: t })
62 } else { // Update previous rate 62 } else { // Update previous rate
63 previousRate.type = rateType 63 previousRate.type = rateType
64 64
65 await previousRate.save() 65 await previousRate.save({ transaction: t })
66 } 66 }
67 } else if (rateType !== 'none') { // There was not a previous rate, insert a new one if there is a rate 67 } else if (rateType !== 'none') { // There was not a previous rate, insert a new one if there is a rate
68 const query = { 68 const query = {