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

FieldTypeRequiredDescriptionConstraints
action_idintegeryes
  • minimum 1
action_typestringyesban, unban, timeout, delete_message, purge, slow_mode, ip_ban, … as Chat and Live name them.
  • minLength 1
  • maxLength 64
scope_typestringyessite, channel, stream, room, …
  • minLength 1
  • maxLength 32
scope_idstring | integer | null
actor_user_idinteger | nullLegacy Live user id of the actor (kept while subjects are adopted).
actor_subjectstring | null
target_user_idinteger | null
target_subjectstring | null
detailsobject

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 }] }