reports module lets a user report an entity, comment, or chat message, and lets moderators read the queue of reports they’re responsible for.
Both functions act on behalf of a named user. Pass that user’s Sublay ID as
actingUserId, the user your service key acts as. For createReport this is the reporter; for fetchModeratedReports
it is the moderator whose queue is returned.createReport
Files a report against an entity, comment, or chat message on behalf of a user. A user has at most one open report of a target: reporting it again returns that same report. Only content users posted can be reported: content with no author (the app’s own, or a deleted account’s) answers400 report/no-author, and content its author deleted or a moderator removed answers 404 report/target-not-found. See Create Report.
One of
spam, inappropriateContent, harassment, misinformation,
hateSpeech, violence, illegalActivity, selfHarm, other. The API
rejects anything else — use other plus details for the rest.Reporting a chat message uses
targetType: "message" with the message id
as targetId — the conversation is resolved server-side. Reports on space
conversations reach space moderators; reports on DMs and group chats are
project-level and appear only in the Sublay dashboard.Promise<CreateReportResponse>
fetchModeratedReports
Returns a paginated list of reports in the spaces the user moderates. Each report is aggregated across all users who reported the same target, and is populated with the target content and space.Filter by target type:
"entity", "comment", or "message". Message
reports appear in this queue only for space conversations — DM and group
reports are project-level and surface in the dashboard.Filter by report status:
"pending", "on-hold", "escalated", "dismissed", "actioned", or "auto-closed".The number of reports to return per page: a whole number from
1 to 100. Defaults to 20. A larger value is rejected with 400 report/invalid-query, never lowered to 100.Promise<PaginatedResponse<Report>>. Each report carries every user’s individual report in userReports ({ id, reportId, userId, reason, details, createdAt, updatedAt }), the moderator’s actionTaken (or null), and:
target— the reported content, typed bytargetType: the stored entity, comment or chat message record with its author asuser(User | null), without the computed fields and associations a regular fetch adds.nullwhen the content can no longer be found.space— the stored record of the space the report was filed in, ornull.
To act on a report (remove content, ban the author, or dismiss it), use
spaces.handleSpaceReport,
which handles every report type in a space.
