Skip to content

fix(listings): don't collapse the feed to Global for non-chapter locations - #1477

Open
rajanpanth wants to merge 1 commit into
SuperteamDAO:mainfrom
rajanpanth:fix/user-location-region-filter
Open

fix(listings): don't collapse the feed to Global for non-chapter locations#1477
rajanpanth wants to merge 1 commit into
SuperteamDAO:mainfrom
rajanpanth:fix/user-location-region-filter

Conversation

@rajanpanth

@rajanpanth rajanpanth commented Aug 19, 2026

Copy link
Copy Markdown

The bug

getRegionsForUserLocationUsingChapters in src/utils/chapterRegion.ts gives up as soon as the user's location has no Superteam chapter:

const chapter = await findChapterByLocation(userLocation);
if (!chapter) return ['Global'];

const regions: string[] = ['Global', userLocation, chapter.region];

buildListingQuery feeds the result straight into the Prisma filter for the home and all contexts:

if (user?.isTalentFilled && (context === 'all' || context === 'home')) {
  where.region = { in: await getUserRegionFilter(user.location) };
}

so for those users the region filter degrades to Global only.

Why it matters

The early return throws away userLocation itself and skips the two multi-country lookups below it, which never needed a chapter — they key off userLocation directly. Two kinds of listing vanish from the feed:

  • listings whose region is the user's own country;
  • listings scoped to a multi-country region containing that country — e.g. a European Union listing for a user in Sweden, or a North America listing for a user in Canada. Both regions are defined statically in src/constants/country.ts and don't depend on any chapter existing.

These are listings the user is allowed to submit to: userRegionEligibilty resolves them via countries[].regions and returns true. So the feed hides work that validateSubmissionRequest would happily accept — a silent discovery gap for every talent user outside a chapter country.

The fix

The chapter lookup is only needed to contribute chapter.region. Push it conditionally instead of returning early; the rest of the function already works without a chapter.


🤖 Generated with Claude Code

…tions

getRegionsForUserLocationUsingChapters bails out with ['Global'] whenever
the user's location has no Superteam chapter. buildListingQuery feeds the
result straight into `where.region = { in: ... }` for the home and all
contexts, so for those users the region filter degrades to "Global only".

Two kinds of listing disappear from the feed as a result:

- listings whose region is the user's own country (userLocation was
  dropped along with everything else), and
- listings scoped to a multi-country region that contains that country,
  e.g. a `European Union` listing for a user located in Sweden, or a
  `North America` listing for a user in Canada.

Both are listings the user is allowed to submit to: userRegionEligibilty
resolves them through countries[].regions and returns true. So the feed
hides work the submission endpoint would happily accept.

The chapter lookup is only needed to add chapter.region; the two
multi-country lookups below already key off userLocation directly and
work fine without a chapter. Push chapter.region conditionally instead of
returning early.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

@rajanpanth is attempting to deploy a commit to the Superteam Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@rajanpanth, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a6767145-ceef-4327-ba22-84faf94c2621

📥 Commits

Reviewing files that changed from the base of the PR and between 145486c and ab87a66.

📒 Files selected for processing (1)
  • src/utils/chapterRegion.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant