Skip to main content

Overview

Returns a function to submit a content report on behalf of the authenticated user. Pass type: "comment", type: "entity", or type: "message" when calling the hook — the returned function is pre-configured for that target type. If the same target already has an open report, the user’s report is appended to it (reports are deduplicated per user, so reporting the same target twice has no additional effect). Once a moderator resolves a report — dismissed or actioned — it is closed. A later report of that same target opens a fresh report rather than reopening the closed one, so previously-dismissed content can be re-reported and returns to the moderation queue.
Requires an authenticated user.

Usage Example

Parameters

"comment" | "entity" | "message"
required
The target type this hook instance will report against. Determines the shape of the returned function.

Returned Function

The hook returns createCommentReport, createEntityReport, or createMessageReport depending on the type argument. All three accept the same parameters:
string
required
The ID of the comment, entity, or chat message being reported. For messages this is the message id — the conversation is resolved server-side, so no conversationId is needed.
ReportReasonKey
required
The reason for the report. Must be one of the following keys:These are enforced by the API: any other value is rejected with report/invalid-body. Use other plus details for anything the taxonomy doesn’t cover.
string
Optional free-text elaboration on the reason.

Returns

The returned function returns Promise<void>. It resolves when the report is accepted (whether created or appended to an existing one).

Notes

  • If the target has an open report this user already filed, the server returns 200 with code report/already-reported without error. The hook function resolves normally in this case. After that report is resolved, the same user may report the target again.
  • You cannot report your own content — the API rejects it with report/self-report.
  • Reporting a message requires membership of its conversation; a non-member gets chat/not-a-member.
  • Where a message report lands depends on the conversation: reports on space conversations reach space moderators via useFetchModeratedReports; reports on DMs and group chats have no space, so they are project-level and appear only in the Sublay dashboard.
  • Reports are scoped to the space the content belongs to, enabling space moderators to action them. See useFetchModeratedReports.