fix: post deletion permissions, modal focus ring, and dropdown hover#3
Merged
Conversation
Prevent Radix Dialog auto-focus so opening via a non-focusable trigger (e.g. an <article> card) doesn't paint a focus-visible ring on the first tabbable element.
Remove the author self-delete bypass in the admin delete handler so the endpoint matches the rest of /api/admin/posts/* (moderator-only). Authors keep their edit path via PATCH /api/posts/:id; deletion is a community- level action because shipped posts carry others' upvotes, comments, and status changes. Split canDelete in usePermission by resource type — posts moderator-only, comments still author-or-moderator (conversational).
Custom --accent is salmon, so focus:bg-accent + focus:text-destructive produced red-on-orange. Drop focus:text-destructive and let the default focus:text-accent-foreground (white) take over on hover.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three focused bug fixes:
DELETE /api/admin/posts/[id]andusePermissionnow gate post deletion behind moderator role instead of allowing broader access.CommentItemandPostDetailDelete actions now use the same hover styling as Edit for visual consistency.Changes
server/api/admin/posts/[id].delete.tsapp/composables/usePermission.tsapp/components/post/PostDetailModal.vueapp/components/comment/CommentItem.vueapp/components/post/PostDetail.vueTest plan