ChatModerationActionPayload chat.moderation.action@1
Generated at from
openvibe-contracts v0.38.0 and
openvibe-sdk v0.5.0.
- Version
- 1.0.0
- Owner
- chat
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Decision
- ADR-022
- Schema
https://openvibe.network/contracts/events/payloads/chat.moderation.action.v1.json
chat.moderation.action v1 (OpenVibe.Chat server/db/database.js logModerationAction). A staff or channel moderator action in chat or in Live (Live's moderation log is written through the chat bridge): bans and unbans (site, channel, IP/CIDR), timeouts, message deletes and purges, slow/sub-only modes, and the like. OpenVibe.Network keeps it in the moderation audit log (ADR-022). Envelope: subject { type: moderation_action, id: <action_id> }, visibility internal, actor the acting person when known. details is free-form per action (never secrets or message text beyond what moderators saw).
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
action_id | integer | yes |
| |
action_type | string | yes | ban, unban, timeout, delete_message, purge, slow_mode, ip_ban, … as Chat and Live name them. |
|
scope_type | string | yes | site, channel, stream, room, … |
|
scope_id | string | integer | null | |||
actor_user_id | integer | null | Legacy Live user id of the actor (kept while subjects are adopted). | ||
actor_subject | string | null | |||
target_user_id | integer | null | |||
target_subject | string | null | |||
details | object |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: channel-timeout
{
"action_id": 813,
"action_type": "timeout",
"scope_type": "channel",
"scope_id": "327",
"actor_user_id": null,
"actor_subject": null,
"target_user_id": null,
"target_subject": null,
"details": {}
}Valid: site-ban
{
"action_id": 812,
"action_type": "ban",
"scope_type": "site",
"scope_id": null,
"actor_user_id": 1,
"actor_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"target_user_id": 44,
"target_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
"details": {
"reason": "spam",
"duration": null
}
}Rejected: extra-field
{
"action_id": 1,
"action_type": "ban",
"scope_type": "site",
"ip": "203.0.113.9"
}Rejected: no-action-type
{
"action_id": 1,
"scope_type": "site",
"details": {}
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('chat.moderation.action@1', value); // { valid, errors: [{ path, message }] }