ModerationAction common.moderation-action@1
Generated at from
openvibe-contracts v0.53.0 and
openvibe-sdk v0.11.0.
- Version
- 1.0.0
- Owner
- network
- Visibility
- public
- Status
- active
- Compatibility
- backward
- Decision
- ADR-022
- Schema
https://openvibe.network/contracts/common/moderation-action.v1.json
common.moderation-action@1 (ADR-022, roadmap WS-D task 1): one staff or moderator action on someone else's content or account, as a service reports it to OpenVibe.Network's moderation audit log. The payload of every <service>.moderation.action event that has no older shape of its own (tools, games, wiki, blog, news, reviews, deals, coupons, trade, codes); modelled on community.moderation.action@1. Written to the service's outbox in the transaction that performs the action. A person acting on their own content is not moderation and is not reported. Envelope: subject { type: moderation_action, id: <target type>:<target id> }, visibility internal, actor the staff member. Never carries the content itself, a secret or an address.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
action | string | yes | A short verb id, as the service names it: <thing>.<what happened> (post.hidden, user.banned, release.revoked, guard.blocked). |
|
target | object | yes |
| |
target.type | string | yes | What was acted on, in the service's own words (post, page, release, user, player, …). |
|
target.id | string | yes |
| |
target.owner_subject | string | null | Whose content or account it was, when known. |
| |
actor_subject | string | null | yes | The staff member or moderator (null only for a service acting without a person). |
|
reason | string | null |
| ||
details | object | Per action: the fields changed, the previous and new state, a bulk action's count, … never the content. |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: minimal
{
"action": "user.banned",
"target": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
},
"actor_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}Valid: post-hidden
{
"action": "post.hidden",
"target": {
"type": "post",
"id": "pst_01JAB2C3D4E5F6G7H8J9K0MNPS",
"owner_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
},
"actor_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"reason": "spam",
"details": {
"previous": "published",
"now": "hidden"
}
}Valid: service-actor
{
"action": "guard.blocked",
"target": {
"type": "address",
"id": "ip:3f9a1c"
},
"actor_subject": null,
"reason": null,
"details": {
"rule": "rate"
}
}Rejected: action-not-an-id
{
"action": "Hid The Post",
"target": {
"type": "post",
"id": "x"
},
"actor_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}Rejected: carries-content
{
"action": "post.hidden",
"target": {
"type": "post",
"id": "x"
},
"actor_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"content": "the post text"
}Rejected: no-actor
{
"action": "post.hidden",
"target": {
"type": "post",
"id": "x"
}
}Rejected: reason-too-long
{
"action": "post.hidden",
"target": {
"type": "post",
"id": "x"
},
"actor_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"reason": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}Rejected: target-extra-field
{
"action": "post.hidden",
"target": {
"type": "post",
"id": "x",
"title": "Hello"
},
"actor_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}Rejected: target-without-id
{
"action": "post.hidden",
"target": {
"type": "post"
},
"actor_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('common.moderation-action@1', value); // { valid, errors: [{ path, message }] }