mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
refactor: move parseInt to filter
This commit is contained in:
@@ -795,12 +795,10 @@ Flags.resolveUserPostFlags = async function (uid, callerUid) {
|
||||
if (meta.config['flags:autoResolveOnBan']) {
|
||||
await batch.processSortedSet(`uid:${uid}:posts`, async (pids) => {
|
||||
let postData = await posts.getPostsFields(pids, ['pid', 'flagId']);
|
||||
postData = postData.filter(p => p && p.flagId);
|
||||
postData = postData.filter(p => p && p.flagId && parseInt(p.flagId, 10));
|
||||
for (const postObj of postData) {
|
||||
if (parseInt(postObj.flagId, 10)) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await Flags.update(postObj.flagId, callerUid, { state: 'resolved' });
|
||||
}
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await Flags.update(postObj.flagId, callerUid, { state: 'resolved' });
|
||||
}
|
||||
}, {
|
||||
batch: 500,
|
||||
|
||||
Reference in New Issue
Block a user