お気に入りを解除できるように

This commit is contained in:
syuilo
2018-10-13 00:54:30 +09:00
parent 1012b2b2c7
commit 719fac6480
4 changed files with 43 additions and 7 deletions

View File

@ -358,8 +358,8 @@ export const pack = async (
})(_note.poll);
}
// Fetch my reaction
if (meId) {
// Fetch my reaction
_note.myReaction = (async () => {
const reaction = await Reaction
.findOne({
@ -374,6 +374,19 @@ export const pack = async (
return null;
})();
// isFavorited
_note.isFavorited = (async () => {
const favorite = await Favorite
.count({
userId: meId,
noteId: id
}, {
limit: 1
});
return favorite === 1;
})();
}
}