fix: 🐛 cannot quote own note

This commit is contained in:
ThatOneCalculator 2023-08-22 20:02:10 -07:00
parent 91b1b5fb53
commit a518f51814
No known key found for this signature in database
GPG Key ID: 8703CACD01000000

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