mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-18 02:20:49 +01:00
ESlint comma-dangle
This commit is contained in:
@@ -30,7 +30,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
hasBookmarked: function (next) {
|
||||
Posts.hasBookmarked(pid, uid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -61,7 +61,7 @@ module.exports = function (Posts) {
|
||||
function (count, next) {
|
||||
results.postData.bookmarks = count;
|
||||
Posts.setPostField(pid, 'bookmarks', count, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -73,12 +73,12 @@ module.exports = function (Posts) {
|
||||
pid: pid,
|
||||
uid: uid,
|
||||
owner: results.owner,
|
||||
current: current
|
||||
current: current,
|
||||
});
|
||||
|
||||
callback(null, {
|
||||
post: results.postData,
|
||||
isBookmarked: isBookmarking
|
||||
isBookmarked: isBookmarking,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ var meta = require('../meta');
|
||||
var cache = LRU({
|
||||
max: parseInt(meta.config.postCacheSize, 10) || 1048576,
|
||||
length: function (n) { return n.length; },
|
||||
maxAge: 1000 * 60 * 60
|
||||
maxAge: 1000 * 60 * 60,
|
||||
});
|
||||
|
||||
module.exports = cache;
|
||||
@@ -16,7 +16,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (tid, next) {
|
||||
topics.getTopicField(tid, 'cid', next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ module.exports = function (Posts) {
|
||||
return map[post.tid];
|
||||
});
|
||||
next(null, cids);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ module.exports = function (Posts) {
|
||||
'tid': tid,
|
||||
'content': content,
|
||||
'timestamp': timestamp,
|
||||
'deleted': 0
|
||||
'deleted': 0,
|
||||
};
|
||||
|
||||
if (data.toPid) {
|
||||
@@ -93,12 +93,12 @@ module.exports = function (Posts) {
|
||||
}
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetAdd, 'pid:' + postData.toPid + ':replies', timestamp, postData.pid),
|
||||
async.apply(db.incrObjectField, 'post:' + postData.toPid, 'replies')
|
||||
async.apply(db.incrObjectField, 'post:' + postData.toPid, 'replies'),
|
||||
], next);
|
||||
},
|
||||
function (next) {
|
||||
db.incrObjectField('global', 'postCount', next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -110,7 +110,7 @@ module.exports = function (Posts) {
|
||||
postData.isMain = isMain;
|
||||
plugins.fireHook('action:post.save', _.clone(postData));
|
||||
next(null, postData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -37,13 +37,13 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (next) {
|
||||
topics.updateTeaser(postData.tid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
function (results, next) {
|
||||
plugins.fireHook('action:post.delete', pid);
|
||||
next(null, postData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -74,13 +74,13 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (next) {
|
||||
topics.updateTeaser(postData.tid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
function (results, next) {
|
||||
plugins.fireHook('action:post.restore', _.clone(postData));
|
||||
next(null, postData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -109,7 +109,7 @@ module.exports = function (Posts) {
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (next) {
|
||||
Posts.dismissFlag(pid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -154,7 +154,7 @@ module.exports = function (Posts) {
|
||||
plugins.fireHook('action:post.purge', pid);
|
||||
db.delete('post:' + pid, next);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -169,7 +169,7 @@ module.exports = function (Posts) {
|
||||
db.sortedSetsRemove([
|
||||
'tid:' + postData.tid + ':posts',
|
||||
'tid:' + postData.tid + ':posts:votes',
|
||||
'uid:' + postData.uid + ':posts'
|
||||
'uid:' + postData.uid + ':posts',
|
||||
], pid, next);
|
||||
},
|
||||
function (next) {
|
||||
@@ -203,9 +203,9 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (next) {
|
||||
notifications.rescind('new_post:tid:' + postData.tid + ':pid:' + pid + ':uid:' + postData.uid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -252,7 +252,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
downvoters: function (next) {
|
||||
db.getSetMembers('pid:' + pid + ':downvote', next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -275,7 +275,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (next) {
|
||||
db.deleteAll(['pid:' + pid + ':upvote', 'pid:' + pid + ':downvote'], next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
});
|
||||
}
|
||||
@@ -290,7 +290,7 @@ module.exports = function (Posts) {
|
||||
}
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetRemove, 'pid:' + toPid + ':replies', pid),
|
||||
async.apply(db.decrObjectField, 'post:' + toPid, 'replies')
|
||||
async.apply(db.decrObjectField, 'post:' + toPid, 'replies'),
|
||||
], callback);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
topic: function (next) {
|
||||
editMainPost(data, postData, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (_results, next) {
|
||||
@@ -76,7 +76,7 @@ module.exports = function (Posts) {
|
||||
function (postData, next) {
|
||||
results.post = postData;
|
||||
next(null, results);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
isMain: function (next) {
|
||||
Posts.isMain(data.pid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -101,7 +101,7 @@ module.exports = function (Posts) {
|
||||
tid: tid,
|
||||
cid: results.topic.cid,
|
||||
isMainPost: false,
|
||||
renamed: false
|
||||
renamed: false,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ module.exports = function (Posts) {
|
||||
tid: tid,
|
||||
cid: results.topic.cid,
|
||||
uid: postData.uid,
|
||||
mainPid: data.pid
|
||||
mainPid: data.pid,
|
||||
};
|
||||
|
||||
if (title) {
|
||||
@@ -147,9 +147,9 @@ module.exports = function (Posts) {
|
||||
slug: topicData.slug,
|
||||
isMainPost: true,
|
||||
renamed: title !== results.topic.title,
|
||||
tags: tags
|
||||
tags: tags,
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ module.exports = function (Posts) {
|
||||
function (next) {
|
||||
async.parallel({
|
||||
hasFlagged: async.apply(Posts.isFlaggedByUser, post.pid, uid),
|
||||
exists: async.apply(Posts.exists, post.pid)
|
||||
exists: async.apply(Posts.exists, post.pid),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -53,17 +53,17 @@ module.exports = function (Posts) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetIncrBy, 'users:flags', 1, post.uid),
|
||||
async.apply(db.incrObjectField, 'user:' + post.uid, 'flags'),
|
||||
async.apply(db.sortedSetAdd, 'uid:' + post.uid + ':flag:pids', now, post.pid)
|
||||
async.apply(db.sortedSetAdd, 'uid:' + post.uid + ':flag:pids', now, post.pid),
|
||||
], next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
function (data, next) {
|
||||
openNewFlag(post.pid, uid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -80,7 +80,7 @@ module.exports = function (Posts) {
|
||||
}
|
||||
if (count === 1) { // Only update state on new flag
|
||||
Posts.updateFlagData(uid, pid, {
|
||||
state: 'open'
|
||||
state: 'open',
|
||||
}, callback);
|
||||
} else {
|
||||
callback();
|
||||
@@ -107,7 +107,7 @@ module.exports = function (Posts) {
|
||||
if (parseInt(postData.flags, 10) > 0) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetIncrBy, 'users:flags', -postData.flags, postData.uid),
|
||||
async.apply(db.incrObjectFieldBy, 'user:' + postData.uid, 'flags', -postData.flags)
|
||||
async.apply(db.incrObjectFieldBy, 'user:' + postData.uid, 'flags', -postData.flags),
|
||||
], next);
|
||||
} else {
|
||||
next();
|
||||
@@ -120,7 +120,7 @@ module.exports = function (Posts) {
|
||||
db.sortedSetsRemove([
|
||||
'posts:flagged',
|
||||
'posts:flags:count',
|
||||
'uid:' + postData.uid + ':flag:pids'
|
||||
'uid:' + postData.uid + ':flag:pids',
|
||||
], pid, next);
|
||||
},
|
||||
function (next) {
|
||||
@@ -135,22 +135,22 @@ module.exports = function (Posts) {
|
||||
var nid = 'post_flag:' + pid + ':uid:' + uid;
|
||||
async.parallel([
|
||||
async.apply(db.delete, 'notifications:' + nid),
|
||||
async.apply(db.sortedSetRemove, 'notifications', 'post_flag:' + pid + ':uid:' + uid)
|
||||
async.apply(db.sortedSetRemove, 'notifications', 'post_flag:' + pid + ':uid:' + uid),
|
||||
], next);
|
||||
}, next);
|
||||
});
|
||||
},
|
||||
async.apply(db.delete, 'pid:' + pid + ':flag:uids')
|
||||
async.apply(db.delete, 'pid:' + pid + ':flag:uids'),
|
||||
], next);
|
||||
},
|
||||
async.apply(db.deleteObjectField, 'post:' + pid, 'flags'),
|
||||
async.apply(db.delete, 'pid:' + pid + ':flag:uid:reason'),
|
||||
async.apply(db.deleteObjectFields, 'post:' + pid, ['flag:state', 'flag:assignee', 'flag:notes', 'flag:history'])
|
||||
async.apply(db.deleteObjectFields, 'post:' + pid, ['flag:state', 'flag:assignee', 'flag:notes', 'flag:history']),
|
||||
], next);
|
||||
},
|
||||
function (results, next) {
|
||||
db.sortedSetsRemoveRangeByScore(['users:flags'], '-inf', 0, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@ module.exports = function (Posts) {
|
||||
var count = posts.length;
|
||||
var end = stop - start + 1;
|
||||
next(null, {posts: posts.slice(0, stop === -1 ? undefined : end), count: count});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -210,7 +210,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
posts: function (next) {
|
||||
Posts.getPostSummaryByPids(pids, uid, {stripTags: false, extraFields: ['flags', 'flag:assignee', 'flag:state', 'flag:notes', 'flag:history']}, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -280,7 +280,7 @@ module.exports = function (Posts) {
|
||||
setImmediate(next.bind(null, null, postObj));
|
||||
}
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ module.exports = function (Posts) {
|
||||
uid: uid,
|
||||
type: property,
|
||||
value: flagObj[property],
|
||||
timestamp: Date.now()
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -339,7 +339,7 @@ module.exports = function (Posts) {
|
||||
history.unshift({
|
||||
uid: uid,
|
||||
type: property,
|
||||
timestamp: Date.now()
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -400,7 +400,7 @@ module.exports = function (Posts) {
|
||||
} else {
|
||||
setImmediate(next);
|
||||
}
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
next(err, event);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ module.exports = function (Posts) {
|
||||
var terms = {
|
||||
day: 86400000,
|
||||
week: 604800000,
|
||||
month: 2592000000
|
||||
month: 2592000000,
|
||||
};
|
||||
|
||||
Posts.getRecentPosts = function (uid, start, stop, term, callback) {
|
||||
@@ -29,7 +29,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (pids, next) {
|
||||
Posts.getPostSummaryByPids(pids, uid, {stripTags: true}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ module.exports = function (Posts) {
|
||||
return uid && array.indexOf(uid) === index;
|
||||
});
|
||||
next(null, uids);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -50,7 +50,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
topicsAndCategories: function (next) {
|
||||
getTopicAndCategories(topicKeys, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -85,7 +85,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (data, next) {
|
||||
next(null, data.posts);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ module.exports = function (Posts) {
|
||||
Posts.parsePost(postData, next);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ module.exports = function (Posts) {
|
||||
}
|
||||
cache.del(pid);
|
||||
Posts.purge(pid, uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (pids, next) {
|
||||
Posts.getPostsByPids(pids, uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (mainPid, next) {
|
||||
next(null, parseInt(pid, 10) === parseInt(mainPid, 10));
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (tid, next) {
|
||||
topics.getTopicFields(tid, fields, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ module.exports = function (Posts) {
|
||||
});
|
||||
|
||||
topics.getTopicsFields(tids, ['slug'], next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -81,7 +81,7 @@ module.exports = function (Posts) {
|
||||
});
|
||||
|
||||
next(null, paths);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ module.exports = function (Posts) {
|
||||
return groupTitle && array.indexOf(groupTitle) === index;
|
||||
});
|
||||
groups.getGroupsData(groupTitles, next);
|
||||
}
|
||||
},
|
||||
], function (err, groupsData) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -38,7 +38,7 @@ module.exports = function (Posts) {
|
||||
slug: group.slug,
|
||||
labelColor: group.labelColor,
|
||||
icon: group.icon,
|
||||
userTitle: group.userTitle
|
||||
userTitle: group.userTitle,
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -73,7 +73,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
customProfileInfo: function (next) {
|
||||
plugins.fireHook('filter:posts.custom_profile_info', {profile: [], uid: userData.uid}, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
||||
@@ -95,7 +95,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
downvotes: function (next) {
|
||||
db.isMemberOfSets(downvoteSets, uid, next);
|
||||
}
|
||||
},
|
||||
}, callback);
|
||||
};
|
||||
|
||||
@@ -144,7 +144,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
reputation: function (next) {
|
||||
user.getUserField(uid, 'reputation', next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -175,7 +175,7 @@ module.exports = function (Posts) {
|
||||
pid: pid,
|
||||
uid: uid,
|
||||
owner: results.owner,
|
||||
current: current
|
||||
current: current,
|
||||
});
|
||||
|
||||
if (!voteStatus || (!voteStatus.upvoted && !voteStatus.downvoted)) {
|
||||
@@ -224,11 +224,11 @@ module.exports = function (Posts) {
|
||||
adjustPostVotes(postData, uid, type, unvote, function (err) {
|
||||
callback(err, {
|
||||
user: {
|
||||
reputation: newreputation
|
||||
reputation: newreputation,
|
||||
},
|
||||
post: postData,
|
||||
upvote: type === 'upvote' && !unvote,
|
||||
downvote: type === 'downvote' && !unvote
|
||||
downvote: type === 'downvote' && !unvote,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -248,7 +248,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (next) {
|
||||
db.setRemove('pid:' + postData.pid + ':' + notType, uid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -260,7 +260,7 @@ module.exports = function (Posts) {
|
||||
},
|
||||
downvotes: function (next) {
|
||||
db.setCount('pid:' + postData.pid + ':downvote', next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
Reference in New Issue
Block a user