X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Flib%2Fblocklist.ts;h=1633e500cb34964b9d9252adfc43c6f41ce6c9b3;hb=b6a1dd4d1b3b0032f8b968e72cbd074f646e8827;hp=394c2453705c139054a839372807ec482da53762;hpb=7ad9b9846c44d198a736183fb186c2039f5236b5;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/blocklist.ts b/server/lib/blocklist.ts index 394c24537..1633e500c 100644 --- a/server/lib/blocklist.ts +++ b/server/lib/blocklist.ts @@ -4,7 +4,7 @@ import { ServerBlocklistModel } from '../models/server/server-blocklist' function addAccountInBlocklist (byAccountId: number, targetAccountId: number) { return sequelizeTypescript.transaction(async t => { - return AccountBlocklistModel.create({ + return AccountBlocklistModel.upsert({ accountId: byAccountId, targetAccountId: targetAccountId }, { transaction: t }) @@ -13,7 +13,7 @@ function addAccountInBlocklist (byAccountId: number, targetAccountId: number) { function addServerInBlocklist (byAccountId: number, targetServerId: number) { return sequelizeTypescript.transaction(async t => { - return ServerBlocklistModel.create({ + return ServerBlocklistModel.upsert({ accountId: byAccountId, targetServerId }, { transaction: t })