Improve authorization management#22
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds optional authorization names (DB + types), persists trimmed nicknames on create, exposes DELETE endpoint to revoke authorizations (transactionally removes redemptions), updates UI to create and revoke nicknamed authorizations, and refactors Nostr Connect signin to accept signerKind options and adjust Amber support detection. ChangesAuthorization Naming and Revocation
Nostr Connect Refactoring
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
…thorization-management # Conflicts: # web/src/lib/nostr.ts
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/src/lib/components/SignInMenu.svelte (1)
92-126:⚠️ Potential issue | 🟠 Major | ⚡ Quick winClear
busywhen a connect session is canceled.If the user clicks Cancel, Lines 133-135 abort the session and null out
connectControllerbefore thefinallyblock runs. That makes the guard on Line 121 fail, sobusynever resets and the modal stays disabled until it is closed and reopened.Suggested fix
function cancelConnectLink() { connectController?.abort(); connectSession?.cancel(); + busy = null; connectController = null; connectSession = null; connectUri = ""; connectError = null; }Also applies to: 132-139
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/lib/components/SignInMenu.svelte` around lines 92 - 126, The finally guard in startConnectSession prevents clearing busy when a session is canceled because cancel logic nulls connectController before finally; update the finally block in startConnectSession so it clears busy and resets connectController when the current controller was used OR when the controller has been aborted (e.g., check controller.signal.aborted or similar), referencing connectController, busy, controller and controller.signal.aborted to ensure busy is always cleared on cancellation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/src/routes/`(app)/teams/[id]/keys/[pubkey]/+page.svelte:
- Around line 109-125: The call to buildAuthHeader can throw but is currently
outside the try/catch so users get no feedback; move the await
api.buildAuthHeader(endpoint, "DELETE", user.pubkey) into the same try block (or
wrap it in its own try/catch) so any signing/header generation errors are caught
and reported via toast.error, then only call api.delete with the resulting
authHeader and update authorizations (referencing buildAuthHeader, api.delete,
authorizationId, authorizations, and toast.error).
---
Outside diff comments:
In `@web/src/lib/components/SignInMenu.svelte`:
- Around line 92-126: The finally guard in startConnectSession prevents clearing
busy when a session is canceled because cancel logic nulls connectController
before finally; update the finally block in startConnectSession so it clears
busy and resets connectController when the current controller was used OR when
the controller has been aborted (e.g., check controller.signal.aborted or
similar), referencing connectController, busy, controller and
controller.signal.aborted to ensure busy is always cleared on cancellation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 09730916-132c-49ee-812f-4633f92ba6e8
📒 Files selected for processing (14)
api/src/api/http/routes.rsapi/src/api/http/teams.rsapi/src/api/types.rscore/src/database.rscore/src/types/authorization.rsdatabase/migrations/0003_add_authorization_name.sqlweb/src/lib/components/AuthorizationCard.svelteweb/src/lib/components/SignInMenu.svelteweb/src/lib/nostr.tsweb/src/lib/types.tsweb/src/lib/utils/auth.tsweb/src/lib/utils/nostr.test.tsweb/src/routes/(app)/teams/[id]/keys/[pubkey]/+page.svelteweb/src/routes/(app)/teams/[id]/keys/[pubkey]/authorizations/new/+page.svelte
Summary
Validation
Summary by CodeRabbit
New Features
Bug Fixes
Sign‑in
Tests