summaryrefslogtreecommitdiff
path: root/player-android/lib/screens/admin_users_screen.dart
AgeCommit message (Collapse)Author
2026-05-22Fix final review issues for AdminUsersScreen (task db)Paul Buetow
- Add bounds check on optimistic create success path to mirror the error path guard - Refactor _CreateUserDialogState.build() by extracting _buildUsernameField() and _buildPasswordField() helpers; remove stale line-count comment - Extract _AdminSection ConsumerWidget from SettingsScreen.build() following the _ThemeToggle pattern Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22Fix review issues in AdminUsersScreen and related files (task db)Paul Buetow
- Replace identity-equality optimistic-create revert with index-based logic (placeholderIdx) to avoid relying on reference equality - Replace insert(index) delete revert with append to avoid stale-index position jitter from concurrent mutations - Remove _RoleBadge key collision; update test to use text finders - currentUserProvider catch block returns null instead of User(id:0) to avoid colliding with the optimistic placeholder sentinel; fix broken comment - adminUserErrorMessage 400-branch delegates to dioErrorMessage to eliminate duplicated JSON body-parsing logic - Add Completer-backed optimistic placeholder visibility test - _EmptyView: replace magic height SizedBox with LayoutBuilder+Center - _CreateUserDialogState: inline _buildForm and _buildActions into build() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22Implement AdminUsersScreen with create/delete user and admin gating (db)Paul Buetow
- Add AdminUsersScreen with user list, create dialog, delete confirmation, and optimistic UI (revert on error) for both create and delete operations. - Add currentUserProvider (FutureProvider) to resolve the logged-in User object from token storage + listUsers, used for self-delete gating and Settings admin section visibility. - Gate Admin section (Manage Users tile) in SettingsScreen behind currentUserProvider → isAdmin, providing defence-in-depth alongside server-side 403 enforcement. - Add adminUserErrorMessage to error_mappers.dart with 400/403/409 handling. - Add adminUsers route constant (AppRoutes.adminUsers) and GoRouter entry. - Add 25 tests in admin_users_screen_test.dart and 3 admin-section tests in settings_screen_test.dart (397 tests total pass). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>