From 7a4ea932461f228ae44a173ddcd48ffb088aa023 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 10 Nov 2020 14:41:20 +0100 Subject: Remove deprecated abuse api --- server/helpers/middlewares/abuses.ts | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'server/helpers/middlewares') diff --git a/server/helpers/middlewares/abuses.ts b/server/helpers/middlewares/abuses.ts index 659ad8939..59ba0d3ed 100644 --- a/server/helpers/middlewares/abuses.ts +++ b/server/helpers/middlewares/abuses.ts @@ -1,29 +1,5 @@ import { Response } from 'express' import { AbuseModel } from '../../models/abuse/abuse' -import { fetchVideo } from '../video' - -// FIXME: deprecated in 2.3. Remove this function -async function doesVideoAbuseExist (abuseIdArg: number | string, videoUUID: string, res: Response) { - const abuseId = parseInt(abuseIdArg + '', 10) - let abuse = await AbuseModel.loadByIdAndVideoId(abuseId, null, videoUUID) - - if (!abuse) { - const userId = res.locals.oauth?.token.User.id - const video = await fetchVideo(videoUUID, 'all', userId) - - if (video) abuse = await AbuseModel.loadByIdAndVideoId(abuseId, video.id) - } - - if (abuse === null) { - res.status(404) - .json({ error: 'Video abuse not found' }) - - return false - } - - res.locals.abuse = abuse - return true -} async function doesAbuseExist (abuseId: number | string, res: Response) { const abuse = await AbuseModel.loadByIdWithReporter(parseInt(abuseId + '', 10)) @@ -42,6 +18,5 @@ async function doesAbuseExist (abuseId: number | string, res: Response) { // --------------------------------------------------------------------------- export { - doesAbuseExist, - doesVideoAbuseExist + doesAbuseExist } -- cgit v1.2.3