]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/rate.ts
Fix tests
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / rate.ts
index 520932c63c028803a74b586032bd2672357612fc..84f42633e7b612689e860f15a6c7cc37df213ff4 100644 (file)
@@ -37,6 +37,9 @@ async function rateVideo (req: express.Request, res: express.Response) {
     const accountInstance = await AccountModel.load(userAccount.id, t)
     const previousRate = await AccountVideoRateModel.load(accountInstance.id, videoInstance.id, t)
 
+    // Same rate, nothing do to
+    if (rateType === 'none' && !previousRate || previousRate?.type === rateType) return
+
     let likesToIncrement = 0
     let dislikesToIncrement = 0