mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Check there are ids in the badIds array
- if there are no ids, we shouldn't add an empty array since it adds unneccessarily to our auto-generated post query and affects greatly performance. see issue #1390
This commit is contained in:
parent
f11091c4ce
commit
75d984073d
@ -11,17 +11,19 @@ const filterForBlockedUsers = async (params, context) => {
|
||||
getBlockedByUsers(context),
|
||||
])
|
||||
const badIds = [...blockedByUsers.map(b => b.id), ...blockedUsers.map(b => b.id)]
|
||||
params.filter = mergeWith(
|
||||
params.filter,
|
||||
{
|
||||
author_not: { id_in: badIds },
|
||||
},
|
||||
(objValue, srcValue) => {
|
||||
if (isArray(objValue)) {
|
||||
return objValue.concat(srcValue)
|
||||
}
|
||||
},
|
||||
)
|
||||
if (badIds.length) {
|
||||
params.filter = mergeWith(
|
||||
params.filter,
|
||||
{
|
||||
author_not: { id_in: badIds },
|
||||
},
|
||||
(objValue, srcValue) => {
|
||||
if (isArray(objValue)) {
|
||||
return objValue.concat(srcValue)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user