Skip to content

Let Content Admin edit starter quests & Add Academy to Village menus#1378

Open
Phrosfire wants to merge 2 commits into
mainfrom
starter-quests
Open

Let Content Admin edit starter quests & Add Academy to Village menus#1378
Phrosfire wants to merge 2 commits into
mainfrom
starter-quests

Conversation

@Phrosfire

@Phrosfire Phrosfire commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Update permission to allow content admin to edit starter quests. This is so he can add new starter quests that take place after the tutorial is completed and the user is already a genin. He is well aware that the tutorials itself should not be touched. The Academy is also being added to the village menu.

License

By making this pull request, I confirm that I have the right to waive copyright and related rights to my contribution, and agree that all copyright and related rights in my contributions are waived, and I acknowledge that the Studie-Tech ApS organization has the copyright to use and modify my contribution for perpetuity.

Summary by CodeRabbit

  • New Features
    • Added an “Academy” entry to the mobile navigation, including the new Academy icon and routing to /academy.
  • Bug Fixes
    • Updated village page visibility so existing Academy-related content appears correctly on the village page.
  • Permissions
    • Expanded starter-quest editing access to users with the CONTENT-ADMIN role (in addition to OWNER).

@Phrosfire Phrosfire requested a review from MathiasGruber as a code owner June 23, 2026 02:00
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
the-ninja-ai Ready Ready Preview, Comment Jun 23, 2026 2:23am
tnr Ready Ready Preview, Comment Jun 23, 2026 2:23am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf658737-b194-401e-90a0-a94ffb104697

📥 Commits

Reviewing files that changed from the base of the PR and between d4f353a and ecdc855.

📒 Files selected for processing (2)
  • app/data/villages.sql
  • app/drizzle/migrations/0018_silly_beast.sql
💤 Files with no reviewable changes (1)
  • app/drizzle/migrations/0018_silly_beast.sql

Walkthrough

The PR updates existing Academy VillageStructure rows to show in the village page via a seed SQL file and a Drizzle migration (0018_silly_beast). It registers Academy as a mobile navigation option with a GraduationCap icon, and extends canEditStarterQuests to permit CONTENT-ADMIN users in addition to OWNER.

Changes

Academy Village Structure, Navigation, and Permission

Layer / File(s) Summary
Academy VillageStructure update and migration
app/data/villages.sql, app/drizzle/migrations/0018_silly_beast.sql, app/drizzle/migrations/meta/_journal.json
Updates VillageStructure rows with route = '/academy' to set showInVillagePage = true in both the seed SQL and the Drizzle migration; the migration entry is registered in the journal as idx: 18.
Mobile nav Academy entry and icon
app/src/libs/mobileNavConfig.ts
Imports GraduationCap from lucide-react, adds { id: "academy", name: "Academy", href: "/academy" } to MOBILE_NAV_OPTIONS, and maps the academy id to GraduationCap in getMobileNavIcon.
canEditStarterQuests permission
app/src/utils/permissions.ts
Role check in canEditStarterQuests expanded from OWNER-only to also include CONTENT-ADMIN.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • studie-tech/TheNinjaRPG#707: Directly related — introduced showInVillagePage usage for Academy entries and the /academy route that this PR updates with VillageStructure rows and a backfill migration.
  • studie-tech/TheNinjaRPG#1100: Directly related — established the mobileNavConfig.ts pattern that this PR extends by adding the Academy navigation option and icon mapping.

Suggested reviewers

  • MathiasGruber

🐇 A hop, a skip, the Academy's here,
Graduation caps shine crystal clear!
Content-Admins quest with newfound might,
Village pages bloom in mobile light. ✨🎓

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes both main changes: allowing Content Admin to edit starter quests and adding Academy to Village menus.
Description check ✅ Passed The description provides clear explanation of both changes, reasoning for the permission update, and includes the required license acknowledgment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch starter-quests

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.

@github-actions github-actions Bot added the size:XXL 1,000+ effective changed lines (test files excluded in mixed PRs). label Jun 23, 2026
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — changes are small, intentional, and well-scoped. The only non-trivial aspect is the broadened starter-quest permission, which is acknowledged in the PR description.

All four changed areas are straightforward: a one-line permission list addition, a one-line nav option addition, a single-statement migration, and the matching seed-file update. No schema changes, no new endpoints, and the existing server-side guard continues to protect the tutorial quest's hidden field. The gap in tutorial-quest coverage (content/objectives remain editable by CONTENT-ADMIN) is a deliberate trade-off documented in the PR description rather than an unintended regression.

No files require special attention. The permission change in permissions.ts is the most consequential edit; the server-side enforcement context in quests.ts was reviewed to confirm no unintended access paths are opened.

Important Files Changed

Filename Overview
app/src/utils/permissions.ts Adds "CONTENT-ADMIN" to canEditStarterQuests; intentional per PR description, but the existing tutorial-quest guard only covers the hidden field, not full content edits.
app/src/libs/mobileNavConfig.ts Adds "academy" entry to MOBILE_NAV_OPTIONS; icon mapping (GraduationCap) already existed and is correctly wired up.
app/drizzle/migrations/0018_silly_beast.sql New migration: sets showInVillagePage = true for the /academy route in VillageStructure; simple and correct.
app/data/villages.sql Adds the same UPDATE statement as the migration to keep the seed file in sync with existing academy rows; addresses the previous review thread concern.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Quest Edit Request] --> B{canChangeContent?}
    B -- No --> C[Reject]
    B -- Yes --> D{Is starter quest?}
    D -- No --> E[Allow edit]
    D -- Yes --> F{canEditStarterQuests?}
    F -- No --> G[Reject: Not allowed]
    F -- Yes\nOWNER or CONTENT-ADMIN --> H{Is tutorial quest ID\nAND hidden=true?}
    H -- Yes --> I[Reject: Cannot edit tutorial quest]
    H -- No --> J[Allow edit\nincl. content & objectives]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Quest Edit Request] --> B{canChangeContent?}
    B -- No --> C[Reject]
    B -- Yes --> D{Is starter quest?}
    D -- No --> E[Allow edit]
    D -- Yes --> F{canEditStarterQuests?}
    F -- No --> G[Reject: Not allowed]
    F -- Yes\nOWNER or CONTENT-ADMIN --> H{Is tutorial quest ID\nAND hidden=true?}
    H -- Yes --> I[Reject: Cannot edit tutorial quest]
    H -- No --> J[Allow edit\nincl. content & objectives]
Loading

Reviews (2): Last reviewed commit: "fix migration" | Re-trigger Greptile

Comment thread app/data/villages.sql Outdated
@MathiasGruber

Copy link
Copy Markdown
Collaborator

/tnr-review-now

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

1. Scope covered

  • Reviewed the PR diff and targeted the two shipped behaviors: Academy added to village/mobile navigation surfaces, and starter-quest edit access expanded to CONTENT-ADMIN.
  • Ran browser-based validation against the preview on a mobile viewport.
  • Used provisioned test users for player flow, and attempted staff-role validation for the starter-quest permission path.

2. Test steps executed

  • Logged in as a provisioned Horizon player in the preview.
  • Opened /village and verified the new Academy building card/link is present.
  • Opened /academy from the village page and confirmed the Academy page renders.
  • Opened Profile -> Edit -> Mobile Navigation, verified Academy appears in the selectable nav options, set Slot 1 to Academy, and confirmed the mobile nav button routes to /academy.
  • Provisioned CONTENT-ADMIN and CONTENT users for the starter-quest permission check.
  • Tried validating the permission change through the preview’s call-endpoint broker and through a fresh Clerk ticket browser login for the staff user.

3. Findings (pass/fail, bugs, risks)

  • Pass: Academy is now visible on the village page for the player account. The new building card rendered and linked to /academy.
  • Pass: The Academy page loads successfully from the player flow and shows the expected Academy/Lessons content.
  • Pass: Mobile Navigation settings now include Academy as a selectable option, and selecting it updates the bottom nav and routes correctly to /academy.
  • Risk / blocked validation: I could not conclusively verify the CONTENT-ADMIN starter-quest edit change end-to-end in this preview.
  • The preview’s call-endpoint broker returned Invalid endpoint path for every tested endpoint, including known valid names like quests.create and profile.get.
  • Fresh CONTENT-ADMIN browser sign-in tickets reached /profile, but navigating to /manual/quest/edit/eYDVpL63vPhK3lywMexdv redirected back to /profile, so I could not exercise a real starter-quest save/update as staff.
  • Based on what I could verify, there is no player-facing regression in the Academy-related change. The unverified area is the staff permission change, and the blocker appears to be preview tooling/auth behavior rather than a confirmed PR defect.

4. Screenshot index

  • player-profile-login.png — provisioned player logged in on mobile.
  • village-academy-visible.png — Academy card visible on the village page.
  • academy-page-player.png — Academy page loaded from player flow.
  • mobile-nav-settings-open.png — Mobile Navigation settings panel open.
  • mobile-nav-academy-configured.png — Academy selected in mobile nav Slot 1 and shown in the bottom nav.

5. Recommendation

  • Needs follow-up
  • Reason: the Academy UI changes passed, but one of the PR’s core changes, CONTENT-ADMIN starter-quest editing, could not be verified end-to-end in this preview because the available staff-review tooling/auth flow was not functioning reliably.

Screenshots

academy page player
academy page player

mobile nav academy configured
mobile nav academy configured

mobile nav settings open
mobile nav settings open

player profile login
player profile login

village academy visible
village academy visible


Run: View workflow run

@MathiasGruber MathiasGruber added the ApprovedButHasMigrations Approved, but has migrations, so Mathias has to merge label Jun 23, 2026

@MathiasGruber MathiasGruber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Logic and DRY review

Comment thread app/data/villages.sql
('wY4rItGdX9-AcUpOdF1S', 'Auction House', 'https://ui0arpl8sm.ufs.sh/f/Hzww9EQvYURJmcDNSqHE4IMO5Goa7cgLxPJ0VC6lU8vbt1Ap', 'XN9oEb5tKAv', '1', '1', '100', '100', '6', '12', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '/auctionhouse', '2026-03-17 00:00:00.000', '1'),
('rHN3laRV2C-df7kkGGFK', 'Auction House', 'https://ui0arpl8sm.ufs.sh/f/Hzww9EQvYURJmcDNSqHE4IMO5Goa7cgLxPJ0VC6lU8vbt1Ap', 'ryBk0qD4EgvPPyav2K4OC', '1', '1', '100', '100', '6', '12', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '/auctionhouse', '2026-03-17 00:00:00.000', '1');

UPDATE `VillageStructure` SET `showInVillagePage` = true WHERE `route` = '/academy';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This UPDATE is a no-op against the seed data: the Academy row inserted at line 146 already has showInVillagePage = '1' as its final column value. The migration (0018_silly_beast.sql) is needed to backfill production, but in the seed file this statement just duplicates state that the INSERT already established. Consider removing it, or alternatively flip the seed insert to 0` so the UPDATE meaningfully exercises the same code path as production.

@github-actions

Copy link
Copy Markdown
Contributor

"Completed" label removed

This PR has 1 unresolved review thread(s). The "Completed" label has been automatically removed.

Please resolve all review threads before re-applying the label.

Unresolved threads:

  • @MathiasGruber: This UPDATE is a no-op against the seed data: the Academy row inserted at line 1...

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

Labels

50 SS ApprovedButHasMigrations Approved, but has migrations, so Mathias has to merge size:XXL 1,000+ effective changed lines (test files excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants