Work was already committed (3bd24fc) and merged to develop.
Crash recovery bean nuzlocke-tracker-ks9c also resolved.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.2 KiB
2.2 KiB
title, status, type, priority, tags, created_at, updated_at, parent, blocked_by
| title | status | type | priority | tags | created_at | updated_at | parent | blocked_by | ||
|---|---|---|---|---|---|---|---|---|---|---|
| Hide edit controls for non-owners in frontend | completed | bug | critical |
|
2026-03-21T12:18:38Z | 2026-03-22T09:03:08Z | nuzlocke-tracker-wwnu |
|
Problem
RunEncounters.tsx has NO auth checks — all edit buttons (encounter modals, boss defeat, status changes, end run, shiny encounters, egg encounters, transfers, HoF team) are always visible, even to logged-out users viewing a public run.
RunDashboard.tsx has canEdit = isOwner || !run?.owner (line 70) which means unowned legacy runs are editable by anyone, including logged-out users.
Approach
- Add
useAuthandcanEditlogic toRunEncounters.tsx, matching the pattern fromRunDashboard.tsxbut stricter:canEdit = isOwner(no fallback for unowned runs) - Update
RunDashboard.tsxline 70 tocanEdit = isOwner(remove|| !run?.owner) - Conditionally render all mutation UI elements based on
canEdit:- Encounter create/edit modals and triggers
- Boss defeat buttons
- Status change / End run buttons
- Shiny encounter / Egg encounter modals
- Transfer modal
- HoF team modal
- Visibility settings toggle
- Show a read-only banner when viewing someone else's run
Checklist
- Add
useAuthimport andcanEditlogic toRunEncounters.tsx - Guard all mutation triggers in
RunEncounters.tsxbehindcanEdit - Update
RunDashboard.tsxcanEditto beisOwneronly (no unowned fallback) - Guard all mutation triggers in
RunDashboard.tsxbehindcanEdit - Add read-only indicator/banner for non-owner viewers
- Verify logged-out users see no edit controls on public runs
Summary of Changes
- Added
useAuthhook andcanEdit = isOwnerlogic toRunEncounters.tsx - Updated
RunDashboard.tsxto use strictcanEdit = isOwner(removed unowned fallback) - All mutation UI elements (encounter modals, boss defeat buttons, status changes, end run, shiny/egg encounters, transfers, HoF team, visibility toggle) are now conditionally rendered based on
canEdit - Added read-only banner for non-owner viewers in both pages
Committed in 3bd24fc and merged to develop.