mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-03 09:06:17 +02:00
Resolve conflicts
This commit is contained in:
@@ -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()
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
res();
|
||||
|
||||
const dec = {};
|
||||
dec[`reaction_counts.${exist.reaction}`] = -1;
|
||||
dec[`reactionCounts.${exist.reaction}`] = -1;
|
||||
|
||||
// Decrement reactions count
|
||||
Post.update({ _id: post._id }, {
|
||||
|
||||
Reference in New Issue
Block a user