From 444c0a0e017824fb4ce526281a22c4abe0a13c50 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 May 2020 16:56:15 +0200 Subject: Add ability to bulk delete comments --- server/middlewares/validators/blocklist.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'server/middlewares/validators/blocklist.ts') diff --git a/server/middlewares/validators/blocklist.ts b/server/middlewares/validators/blocklist.ts index 27224ff9b..c24fa9609 100644 --- a/server/middlewares/validators/blocklist.ts +++ b/server/middlewares/validators/blocklist.ts @@ -24,8 +24,7 @@ const blockAccountValidator = [ if (user.Account.id === accountToBlock.id) { res.status(409) - .send({ error: 'You cannot block yourself.' }) - .end() + .json({ error: 'You cannot block yourself.' }) return } @@ -80,8 +79,7 @@ const blockServerValidator = [ if (host === WEBSERVER.HOST) { return res.status(409) - .send({ error: 'You cannot block your own server.' }) - .end() + .json({ error: 'You cannot block your own server.' }) } const server = await ServerModel.loadOrCreateByHost(host) @@ -139,8 +137,7 @@ async function doesUnblockAccountExist (accountId: number, targetAccountId: numb const accountBlock = await AccountBlocklistModel.loadByAccountAndTarget(accountId, targetAccountId) if (!accountBlock) { res.status(404) - .send({ error: 'Account block entry not found.' }) - .end() + .json({ error: 'Account block entry not found.' }) return false } @@ -154,8 +151,7 @@ async function doesUnblockServerExist (accountId: number, host: string, res: exp const serverBlock = await ServerBlocklistModel.loadByAccountAndHost(accountId, host) if (!serverBlock) { res.status(404) - .send({ error: 'Server block entry not found.' }) - .end() + .json({ error: 'Server block entry not found.' }) return false } -- cgit v1.2.3