Skip to main content

Overview

Returns a function that allows a space moderator to take action on an entity report. Available actions are: remove the entity from the space, ban the reporting target’s author, or dismiss the report. Multiple actions can be combined in a single call (e.g., remove the entity and ban the user simultaneously).
Requires the authenticated user to have admin or moderator role in the target space.

Usage Example

import { useHandleSpaceEntityReport } from "@replyke/react-js";

function EntityReportActions({ report }) {
  const handleSpaceEntityReport = useHandleSpaceEntityReport();

  const removeAndBan = async () => {
    await handleSpaceEntityReport({
      spaceId: report.spaceId,
      reportId: report.id,
      entityId: report.targetId,
      actions: ["remove-entity", "ban-user"],
      summary: "Removed spam content and banned user from space",
      userId: report.target?.userId,
    });
  };

  const dismiss = async () => {
    await handleSpaceEntityReport({
      spaceId: report.spaceId,
      reportId: report.id,
      entityId: report.targetId,
      actions: ["dismiss"],
      summary: "Content reviewed — no violation found",
    });
  };

  return (
    <div>
      <button onClick={removeAndBan}>Remove & Ban</button>
      <button onClick={dismiss}>Dismiss</button>
    </div>
  );
}

Parameters

spaceId
string
required
The ID of the space the report belongs to.
reportId
string
required
The ID of the report to action.
entityId
string
required
The ID of the reported entity.
actions
Array<'remove-entity' | 'ban-user' | 'dismiss'>
required
One or more actions to take. Multiple actions are applied together.
  • remove-entity — Removes the entity from the space.
  • ban-user — Bans the entity’s author from the space (requires userId).
  • dismiss — Marks the report as dismissed without taking action on the content.
summary
string
required
A moderator note describing the action taken. Stored on the report record.
userId
string
The ID of the user to ban. Required when ban-user is included in actions.
reason
string
The reason for banning, if applicable.

Returns

Returns Promise<{ message: string; code: string }>.

Notes