Skip to content

feat: support parent-based areaRestrictions in config for areas.json#1195

Open
unseenmagik wants to merge 6 commits intoWatWowMap:developfrom
unseenmagik:main
Open

feat: support parent-based areaRestrictions in config for areas.json#1195
unseenmagik wants to merge 6 commits intoWatWowMap:developfrom
unseenmagik:main

Conversation

@unseenmagik
Copy link
Contributor

📝 PR Overview

  • feature: non breaking, additional config option.

For those that still use an areas.json file (rather than Koji), you can add a new parent parameter in the features.collection which can be used to filter access to areas on ReactMap.

  • Added a new optional parent: string[] field to authentication.areaRestrictions so you can grant access by parent area name (and automatically include all child areas).
  • Updated areaPerms.js to:
    • accept parent in the restriction rule,
    • build a parent→child key map from loaded geojson,
    • and grant access for both the parent area and its children.
  • Updated GraphQL area filtering (scanAreas / scanAreasMenu) to allow permissions to match by feature.properties.key (in addition to name/parent) so the filtering behavior stays consistent with the new parent-based key logic.
  • Updated type definitions (config.d.ts) to reflect the new optional parent array.
  • Updated the example config (local.example.json) with parent: [] entries for documentation and schema clarity.

Mygod and others added 5 commits March 14, 2026 23:11
# [1.41.0](WatWowMap/ReactMap@v1.40.1...v1.41.0) (2026-03-15)

### Bug Fixes

* area reload ([cea3141](WatWowMap@cea3141))
* battle/raid filtering race condition ([2a9cbbf](WatWowMap@2a9cbbf))
* battle/raid icon max height ([497f350](WatWowMap@497f350))
* ditto shenanigans ([WatWowMap#1193](WatWowMap#1193)) ([647a175](WatWowMap@647a175))
* escape gpx xml ([WatWowMap#1186](WatWowMap#1186)) ([7bd5ce1](WatWowMap@7bd5ce1))
* ground raid/battle icons ([cd01a92](WatWowMap@cd01a92))
* hidden power in raids are fighting type ([018ba93](WatWowMap@018ba93))
* im dumdum ([ce37e2a](WatWowMap@ce37e2a))
* logic bug in loading non-clustered elements ([WatWowMap#1161](WatWowMap#1161)) ([a2c7f17](WatWowMap@a2c7f17))
* more robust discord handling ([WatWowMap#1181](WatWowMap#1181)) ([b579ded](WatWowMap@b579ded))
* no scrollbars plz ([907ca33](WatWowMap@907ca33))
* pokemon onlyManualId filter in expert sql mode ([ee176da](WatWowMap@ee176da))
* properly migrate to express 5 ([3907656](WatWowMap@3907656))
* remove extra Forms ([0f157ed](WatWowMap@0f157ed))
* sentry node version ([8640ee0](WatWowMap@8640ee0))
* showcase icons display ([b626d3d](WatWowMap@b626d3d))
* weather icon in pokemon background popup ([21b50f5](WatWowMap@21b50f5))

### Features

* ar/no-ar quest dot badge ([8adba28](WatWowMap@8adba28))
* default clientPrompt to none to skip permission reapproval ([d3ea283](WatWowMap@d3ea283))
* dynamic placed Pokemon dropdown height ([8a0447c](WatWowMap@8a0447c))
* support stationed pokemon extras ([4f5aace](WatWowMap@4f5aace))
## [1.41.1](WatWowMap/ReactMap@v1.41.0...v1.41.1) (2026-03-15)

### Bug Fixes

* workflow git creds ([e5dc6f9](WatWowMap@e5dc6f9))
## 📝 Commit description (detailed)

- Added a new optional `parent: string[]` field to `authentication.areaRestrictions` so admins can grant access by parent area name (and automatically include all child areas).
- Updated areaPerms.js to:
  - accept `parent` in the restriction rule,
  - build a parent→child key map from loaded geojson,
  - and grant access for both the parent area and its children.
- Updated GraphQL area filtering (`scanAreas` / `scanAreasMenu`) to allow permissions to match by `feature.properties.key` (in addition to `name`/`parent`) so the filtering behavior stays consistent with the new parent-based key logic.
- Updated type definitions (config.d.ts) to reflect the new optional `parent` array.
- Updated the example config (local.example.json) with `parent: []` entries for documentation and schema clarity.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 600eed64d7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +54 to +55
if (areas.names.has(parent)) perms.push(parent)
if (parentKeyMap[parent]) perms.push(...parentKeyMap[parent])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve parent polygons when users filter scan areas

Adding the parent key here makes perms.areaRestrictions broader than the keys the area picker can round-trip. The parent-row toggle in src/features/drawer/areas/Child.jsx:107-113 only submits childAreas.map(...key), and server/src/utils/consolidateAreas.js:23-27 then replaces the original permission set with that onlyAreas list. On configs where the parent polygon covers space outside its children (for example a hidden grouping polygon), a user with parent: [...] will see that outer region on first load and then silently lose it as soon as they use the scan-area filter.

Useful? React with 👍 / 👎.

Adjust area permission handling and grouped child-area selection.

Include the parent area key in grouped toggles when present, while
preserving existing single-child behavior.
@Mygod Mygod changed the base branch from main to develop March 20, 2026 02:56
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.

3 participants