forked from FoundKeyGang/FoundKey
Merge branch 'develop' of https://github.com/syuilo/misskey into develop
This commit is contained in:
commit
7de915d47b
1 changed files with 0 additions and 3 deletions
|
@ -35,20 +35,17 @@ export const meta = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, async (ps, user) => {
|
export default define(meta, async (ps, user) => {
|
||||||
// Get favoritee
|
|
||||||
const note = await getNote(ps.noteId).catch(e => {
|
const note = await getNote(ps.noteId).catch(e => {
|
||||||
if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||||
throw e;
|
throw e;
|
||||||
});
|
});
|
||||||
|
|
||||||
// if already favorited
|
|
||||||
const exist = await PromoNotes.findOne(note.id);
|
const exist = await PromoNotes.findOne(note.id);
|
||||||
|
|
||||||
if (exist != null) {
|
if (exist != null) {
|
||||||
throw new ApiError(meta.errors.alreadyPromoted);
|
throw new ApiError(meta.errors.alreadyPromoted);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create favorite
|
|
||||||
await PromoNotes.save({
|
await PromoNotes.save({
|
||||||
noteId: note.id,
|
noteId: note.id,
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
|
|
Loading…
Reference in a new issue