mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-23 17:19:53 +02: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']) {
|
if (meta.config['flags:autoResolveOnBan']) {
|
||||||
await batch.processSortedSet(`uid:${uid}:posts`, async (pids) => {
|
await batch.processSortedSet(`uid:${uid}:posts`, async (pids) => {
|
||||||
let postData = await posts.getPostsFields(pids, ['pid', 'flagId']);
|
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) {
|
for (const postObj of postData) {
|
||||||
if (parseInt(postObj.flagId, 10)) {
|
// eslint-disable-next-line no-await-in-loop
|
||||||
// eslint-disable-next-line no-await-in-loop
|
await Flags.update(postObj.flagId, callerUid, { state: 'resolved' });
|
||||||
await Flags.update(postObj.flagId, callerUid, { state: 'resolved' });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
batch: 500,
|
batch: 500,
|
||||||
|
|||||||
Reference in New Issue
Block a user