fix(accounts): preserve comment moderation author edits#63
Conversation
|
Warning Review limit reached
More reviews will be available in 28 minutes and 53 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
commentModeration.authoras a distinct account-edit summary key so author ban and unban moderation edits are not lost or confused with the comment author object.useEditedComment, updating bothcommentModeration.authorandauthor.community.banExpiresAtfor immediate UI feedback.Verification
yarn buildyarn lint(existing warning backlog, exits 0)yarn type-checkyarn testyarn test src/hooks/accounts/accounts.test.ts src/stores/accounts/utils.test.ts src/stores/accounts/accounts-actions.test.tsyarn test:coverage:hooks-storesruns all tests successfully; the verifier still exits nonzero on existing repo-wide hooks/store coverage baseline gaps unrelated to this change.Note
Medium Risk
Touches moderation/ban state reconciliation in hooks and account edit summaries; wrong logic could show incorrect ban status or premature success, but scope is limited and well covered by new tests.
Overview
Fixes how author ban/unban comment-moderation edits are tracked and shown in the UI.
Account edit summaries now store author moderation under a dedicated key (
commentModeration.author) instead of flattening it into a genericauthorfield, and explicit unbans (author: undefined) are kept in summaries instead of being dropped.useEditedCommentcompares and applies those edits by syncing bothcommentModeration.authorandauthor.community.banExpiresAt, including staying pending when refreshed comment data still shows a stale ban. Store normalization and tests were updated for ban, unban, and persisted-summary behavior.Reviewed by Cursor Bugbot for commit b867b01. Bugbot is set up for automated code reviews on this repo. Configure here.