return sequelizeTypescript.transaction(async t => {
if (!byActor.Account) throw new Error('Unknown account ' + byActor.url)
- const rate = await AccountVideoRateModel.load(byActor.Account.id, video.id, t)
+ let rate = await AccountVideoRateModel.loadByUrl(likeActivity.id, t)
+ if (!rate) rate = await AccountVideoRateModel.load(byActor.Account.id, video.id, t)
if (!rate) throw new Error(`Unknown rate by account ${byActor.Account.id} for video ${video.id}.`)
await rate.destroy({ transaction: t })
return sequelizeTypescript.transaction(async t => {
if (!byActor.Account) throw new Error('Unknown account ' + byActor.url)
- const rate = await AccountVideoRateModel.load(byActor.Account.id, video.id, t)
+ let rate = await AccountVideoRateModel.loadByUrl(dislike.id, t)
+ if (!rate) rate = await AccountVideoRateModel.load(byActor.Account.id, video.id, t)
if (!rate) throw new Error(`Unknown rate by account ${byActor.Account.id} for video ${video.id}.`)
await rate.destroy({ transaction: t })
return sequelizeTypescript.transaction(async t => {
const cacheFile = await VideoRedundancyModel.loadByUrl(cacheFileObject.id)
- if (!cacheFile) throw new Error('Unknown video cache ' + cacheFile.url)
+ if (!cacheFile) throw new Error('Unknown video cache ' + cacheFileObject.id)
if (cacheFile.actorId !== byActor.id) throw new Error('Cannot delete redundancy ' + cacheFile.url + ' of another actor.')