From a518f518142b6d537a423e0e3a87957035534195 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Tue, 22 Aug 2023 20:02:10 -0700 Subject: [PATCH] fix: :bug: cannot quote own note --- .../backend/src/server/api/endpoints/notes/edit.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/backend/src/server/api/endpoints/notes/edit.ts b/packages/backend/src/server/api/endpoints/notes/edit.ts index 5244cff6af..e2c2561243 100644 --- a/packages/backend/src/server/api/endpoints/notes/edit.ts +++ b/packages/backend/src/server/api/endpoints/notes/edit.ts @@ -146,6 +146,12 @@ export const meta = { code: "CANNOT_CHANGE_VISIBILITY", id: "2917fd0b-da04-41de-949f-146835a006c6", }, + + cannotQuoteOwnNote: { + message: "You cannot quote your own note.", + code: "CANNOT_QUOTE_OWN_NOTE", + id: "070eee98-5f8a-4eca-9dc0-830b4d4e52ac", + }, } } as const; @@ -274,6 +280,10 @@ export default define(meta, paramDef, async (ps, user) => { throw e; }); + if (ps.renoteId === note.id) { + throw new ApiError(meta.errors.cannotQuoteOwnNote); + } + if (renote.renoteId && !renote.text && !renote.fileIds && !renote.hasPoll) { throw new ApiError(meta.errors.cannotReRenote); }