Fix comments

This commit is contained in:
syuilo 2020-02-20 23:26:35 +09:00 committed by GitHub
parent 4637839e30
commit ba9762d391

View file

@ -35,20 +35,17 @@ export const meta = {
};
export default define(meta, async (ps, user) => {
// Get favoritee
const note = await getNote(ps.noteId).catch(e => {
if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
throw e;
});
// if already favorited
const exist = await PromoNotes.findOne(note.id);
if (exist != null) {
throw new ApiError(meta.errors.alreadyPromoted);
}
// Create favorite
await PromoNotes.save({
noteId: note.id,
createdAt: new Date(),