- const [ , created ] = await AccountVideoRateModel.findOrCreate({
- where: rate,
- defaults: Object.assign({}, rate, { url: getVideoDislikeActivityPubUrl(byActor, video) }),
- transaction: t
- })
- if (created === true) await video.increment('dislikes', { transaction: t })
+ const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t)
+ if (existingRate && existingRate.type === 'dislike') return