+async function sendVideoRateChangeToFollowers (
+ account: AccountInstance,
+ video: VideoInstance,
+ likes: number,
+ dislikes: number,
+ t: Transaction
+) {
+ // Keep the order: first we undo and then we create
+
+ // Undo Like
+ if (likes < 0) await sendUndoLikeToVideoFollowers(account, video, t)
+ // Undo Dislike
+ if (dislikes < 0) await sendUndoDislikeToVideoFollowers(account, video, t)
+
+ // Like
+ if (likes > 0) await sendLikeToVideoFollowers(account, video, t)
+ // Dislike
+ if (dislikes > 0) await sendCreateDislikeToVideoFollowers(account, video, t)
+}
+
+async function sendVideoRateChangeToOrigin (
+ account: AccountInstance,
+ video: VideoInstance,
+ likes: number,
+ dislikes: number,
+ t: Transaction
+) {
+ // Keep the order: first we undo and then we create
+
+ // Undo Like
+ if (likes < 0) await sendUndoLikeToOrigin(account, video, t)
+ // Undo Dislike
+ if (dislikes < 0) await sendUndoDislikeToOrigin(account, video, t)
+
+ // Like
+ if (likes > 0) await sendLikeToOrigin(account, video, t)
+ // Dislike
+ if (dislikes > 0) await sendCreateDislikeToOrigin(account, video, t)
+}
+