Skip to content

feat(admin): ✨ add report reasons management module with CRUD operations - #890

Merged
aXenDeveloper merged 2 commits into
canaryfrom
feat(admin)--add-report-reasons-management-module-with-CRUD-operations
Oct 19, 2026
Merged

aXenDeveloper merged 2 commits into
canaryfrom
feat(admin)--add-report-reasons-management-module-with-CRUD-operations

Conversation

@aXenDeveloper

Copy link
Copy Markdown
Owner

Improving Documentation

Description

What?

Why?

@github-actions github-actions Bot added the 💡 Feature A new feature label Oct 19, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T17:14:09.967083Z b4e3b09 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

React Doctor found 4 new issues in 2 files · 2 errors & 2 warnings · score 84 / 100 (Needs work) · 0 fixed · vs canary

Errors

2 warnings

scripts/prepare-database.ts

  • ⚠️ L71 await inside a loop async-await-in-loop
  • ⚠️ L892 await inside a loop async-await-in-loop

Reviewed by React Doctor for commit b4e3b09. See inline comments for fixes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ba486676b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +137 to +138
if (total >= MODERATION_LIMITS.maxReportReasons) {
return c.json({ error: "limit_reached" }, 409);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce the reason limit atomically

Serialize this check with the insertion or enforce the maximum in the database. If two administrators create reasons while nine exist, both requests can observe total === 9 and both insert, leaving 11 reasons despite the documented hard limit.

Useful? React with 👍 / 👎.

Comment on lines +224 to +227
const [{ total }] = await db
.select({ total: count() })
.from(core_moderation_report_reasons);
if (total <= 1) return c.json({ error: "last_reason" }, 409);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prevent concurrent deletion of the final reasons

Make the count check and deletion one serialized operation. When two reasons remain, two administrators can delete different reasons concurrently; both requests can read total === 2, then both transactions delete successfully, leaving no reason and an empty report dialog.

Useful? React with 👍 / 👎.

const observer = new ResizeObserver(([entry]) => {
setHeight(entry.borderBoxSize[0].blockSize);
});
observer.observe(element);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/effect-needs-cleanup (error)

observe creates a subscription in a function that outlives the render, with no cleanup path. Store the handle and release it, or move this into a useEffect that returns cleanup, so it does not leak after unmount.

Fix → Return a cleanup function that stops the subscription or timer: return () => target.removeEventListener(name, handler) for listeners, return () => clearInterval(id) or clearTimeout(id) for timers, return () => observer.disconnect() for observers, return () => socket.close() for connections, or return unsubscribe if the subscribe call already gave you one.

Docs

<MotionConfig reducedMotion="user">
<MotionFeatures>
<m.div
animate={{ height: visibleHeight }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-layout-property-animation (error)

This stutters because animating "height" makes the browser redo page layout every frame, so animate transform or scale instead, or use the layout prop

Fix → Use transform: translateX() or scale() instead. They animate smoothly without making the browser redo layout or repaint

Docs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4e3b097e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -1,495 +0,0 @@
import { describe, expect, it } from "vitest";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore the deleted navigation model tests

Adding the moderation group only requires updating the root-admin navigation expectation, but this deletes the only direct suite for adminNavDeclarations, resolveAdminNav, and adminNavNamespaces, including plugin permission namespacing and opt-out behavior. The remaining search-sources.test.ts covers only a subset through the flattened palette, so sidebar and namespace regressions can now pass unnoticed; restore and update this suite instead.

AGENTS.md reference: AGENTS.md:L128-L132

Useful? React with 👍 / 👎.

});
if (!created) return c.json({ error: "limit_reached" }, 409);

await saveReasonWords(c, created.id, body);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Roll back creation when translations fail

Keep the reason row and its language words in one transaction. If saveReasonWords fails after the preceding transaction commits—for example, because the request supplies a nonexistent languageCode, which this schema permits but the language foreign key rejects—the endpoint returns an error while leaving a titleless reason that is visible to members and consumes one of the ten slots.

Useful? React with 👍 / 👎.

@aXenDeveloper
aXenDeveloper merged commit 96ccc82 into canary Oct 19, 2026
7 checks passed
@aXenDeveloper
aXenDeveloper deleted the feat(admin)--add-report-reasons-management-module-with-CRUD-operations branch October 19, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 Feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant