1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-09 06:44:01 +02:00
This commit is contained in:
syuilo
2018-03-28 16:39:14 +09:00
parent 7d4d9dbaa6
commit 3d5cdb8d2d
237 changed files with 1661 additions and 1354 deletions

View File

@@ -14,9 +14,9 @@ import Post from '../../../models/post';
* @return {Promise<any>}
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'post_id' parameter
const [postId, postIdErr] = $(params.post_id).id().$;
if (postIdErr) return rej('invalid post_id param');
// Get 'postId' parameter
const [postId, postIdErr] = $(params.postId).id().$;
if (postIdErr) return rej('invalid postId param');
// Fetch unreactee
const post = await Post.findOne({
@@ -29,9 +29,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
// if already unreacted
const exist = await Reaction.findOne({
post_id: post._id,
user_id: user._id,
deleted_at: { $exists: false }
postId: post._id,
userId: user._id,
deletedAt: { $exists: false }
});
if (exist === null) {
@@ -43,7 +43,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
_id: exist._id
}, {
$set: {
deleted_at: new Date()
deletedAt: new Date()
}
});