Oops, fix manually NC condition!

Oops, we weren't doing a good job encapsulating the different conditions in item search. The `OR` in the NC condition was causing a precedence problem!

Now, we wrap all the conditions in parens at the interpolation site, to make it really clear that they all need to be made safe like that!

Now, there's not a bunch of "??????" entries in NC search, oops 😅
This commit is contained in:
Emi Matchu 2021-03-14 05:28:57 -07:00
parent 927401fc92
commit 535abec228

View file

@ -339,10 +339,9 @@ const buildItemSearchLoader = (db, loaders) =>
`; `;
const queryConditions = ` const queryConditions = `
${matcherPlaceholders} AND t.locale = "en" AND (${matcherPlaceholders}) AND t.locale = "en" AND
${bodyIdCondition} AND (${bodyIdCondition}) AND (${zoneIdsCondition}) AND
${zoneIdsCondition} AND ${itemKindCondition} AND (${itemKindCondition}) AND (${currentUserCondition})
${currentUserCondition}
`; `;
const queryConditionValues = [ const queryConditionValues = [
...wordMatchersForMysql, ...wordMatchersForMysql,