Skip to content

Commit

Permalink
fix: Ignore empty target rules
Browse files Browse the repository at this point in the history
  • Loading branch information
d-beezee committed Aug 8, 2024
1 parent e1148e4 commit ed9fb3c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/routes/users/me/campaigns/_get/UserTargetChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,19 @@ export class UserTargetChecker {
if (Object.keys(targetRules).length === 0) return true;
const { languages, countries } = targetRules;

if (languages && !languages.some((l) => this.userLanguages.includes(l))) {
if (
languages &&
languages.length &&
!languages.some((l) => this.userLanguages.includes(l))
) {
return false;
}

if (countries && !countries.includes(this.userCountry)) {
if (
countries &&
countries.length &&
!countries.includes(this.userCountry)
) {
return false;
}

Expand Down

0 comments on commit ed9fb3c

Please sign in to comment.