]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/blocklist.ts
Merge branch 'release/v1.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / lib / blocklist.ts
index 394c2453705c139054a839372807ec482da53762..1633e500cb34964b9d9252adfc43c6f41ce6c9b3 100644 (file)
@@ -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 })