fix: 🐛 cannot quote own note

This commit is contained in:
ThatOneCalculator 2023-08-22 20:02:10 -07:00 committed by Jeder
parent 5e69fd791c
commit 4fa47bf677

View file

@ -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);
}