summaryrefslogtreecommitdiff
path: root/src/models/note.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/note.ts')
-rw-r--r--src/models/note.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/models/note.ts b/src/models/note.ts
index a47fd098c7..e6bdbe0b8b 100644
--- a/src/models/note.ts
+++ b/src/models/note.ts
@@ -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;
+ })();
}
}