From 053b47d78a59e79f0ab61baaf87c6562eefc3517 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Mon, 21 Oct 2024 14:19:26 -0400 Subject: [PATCH] return error when calling following feed with both includeReplies and filesOnly --- .../src/server/api/endpoints/notes/following.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/backend/src/server/api/endpoints/notes/following.ts b/packages/backend/src/server/api/endpoints/notes/following.ts index 5df52e4045..10c211b1fc 100644 --- a/packages/backend/src/server/api/endpoints/notes/following.ts +++ b/packages/backend/src/server/api/endpoints/notes/following.ts @@ -27,6 +27,14 @@ export const meta = { ref: 'Note', }, }, + + errors: { + bothWithRepliesAndWithFiles: { + message: 'Specifying both includeReplies and filesOnly is not supported', + code: 'BOTH_INCLUDE_REPLIES_AND_FILES_ONLY', + id: '91c8cb9f-36ed-46e7-9ca2-7df96ed6e222', + }, + }, } as const; export const paramDef = { @@ -58,6 +66,8 @@ export default class extends Endpoint { // eslint- private queryService: QueryService, ) { super(meta, paramDef, async (ps, me) => { + if (ps.includeReplies && ps.filesOnly) throw new ApiError(meta.errors.bothWithRepliesAndWithFiles); + const query = this.notesRepository .createQueryBuilder('note') .setParameter('me', me.id)