add residential listing limit#88
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Updates to Preview Branch (dnywh/residential-listing-limit) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
There was a problem hiding this comment.
Pull request overview
Adds a per-user residential-listing cap (3) on top of the existing 12-listing total cap. Enforces the cap via an updated RLS insert policy backed by a new count_user_listings_by_type helper, hides the residential option in the listing-type chooser when the cap is reached, and updates the too-many-listings copy. Seeds two extra hidden residential demo listings (bringing the demo donor to 3 residential listings) and adds Playwright coverage for the capped chooser state.
Changes:
- New migration replaces the listings INSERT RLS policy to add a 3-residential cap (admins bypass) and adds a
(owner_id, type)index plus acount_user_listings_by_typefunction. - Server-rendered chooser page filters out the residential (and total-capped) options and renders an empty-state message;
ListingTypeChoosernow acceptsemptyMessage. - Listing-limit copy across all locales is generalised, a new
Listings.new.noAvailableOptionskey is added, theMAX_LISTINGSmagic number is extracted tosrc/config/listingLimits.ts, and Playwright/seed fixtures cover the capped scenario.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| supabase/migrations/20260515061033_add_residential_listing_limit.sql | New RLS insert policy adding residential cap + supporting function and index |
| supabase/seed.sql | Adds two hidden residential demo listings (1007, 1008) for the donor and updates seq/slugs |
| src/config/listingLimits.ts | New constants for total and residential per-user limits |
| src/app/(forms)/profile/listings/new/page.tsx | Fetches user listings/profile and filters chooser options by cap |
| src/components/ListingTypeChooser.tsx | Renders emptyMessage when no options are available |
| src/components/ProfileListings/ProfileListings.tsx | Uses the new shared MAX_LISTINGS_PER_USER constant |
| messages/{en,de,es,fr,pt-BR}.json | Generalises tooManyListings copy and adds noAvailableOptions |
| e2e/listings.spec.ts | Adds Playwright test for the capped residential chooser state |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Validation
Note:
supabase migration up --localis blocked by a pre-existing local migration history mismatch for remote migration20260514043101, so I validated this migration directly against the local database instead.