diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-20 04:24:19 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-20 04:24:19 +0900 |
| commit | b05bee58d28c3209d7f86a909f877c1e121c12ed (patch) | |
| tree | 96efc12c89479b63dbc339ab18bcf9dde9dd6bcc /src/api/serializers/post.ts | |
| parent | [Client] :art: (diff) | |
| download | misskey-b05bee58d28c3209d7f86a909f877c1e121c12ed.tar.gz misskey-b05bee58d28c3209d7f86a909f877c1e121c12ed.tar.bz2 misskey-b05bee58d28c3209d7f86a909f877c1e121c12ed.zip | |
#298
Diffstat (limited to 'src/api/serializers/post.ts')
| -rw-r--r-- | src/api/serializers/post.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/api/serializers/post.ts b/src/api/serializers/post.ts index f459529697..3c96884dd1 100644 --- a/src/api/serializers/post.ts +++ b/src/api/serializers/post.ts @@ -4,7 +4,7 @@ import * as mongo from 'mongodb'; import deepcopy = require('deepcopy'); import Post from '../models/post'; -import Like from '../models/like'; +import Reaction from '../models/post-reaction'; import Vote from '../models/poll-vote'; import serializeApp from './app'; import serializeUser from './user'; @@ -100,18 +100,18 @@ const self = ( } } - // Check if it is liked + // Fetch my reaction if (me && opts.detail) { - const liked = await Like - .count({ + const reaction = await Reaction + .findOne({ user_id: me._id, post_id: id, deleted_at: { $exists: false } - }, { - limit: 1 }); - _post.is_liked = liked === 1; + if (reaction) { + _post.my_reaction = reaction.reaction; + } } resolve(_post); |