Skip to content

Content Pipeline

Content passes three gates before it is public: moderation mode decides whether a human must look, visibility decides who can read, gate rules decide whether this user may write.

  • report:manage for /admin/moderation and /admin/reports; gate:manage for /admin/gates.
  • banned:manage / user:update for mutes and bans; the mode switch is in ?tab=content.

moderation_mode holds one of four values, default async.

ModeWhen it runsBehaviour
offNeverPublished immediately; no rules, no records
asyncAfter publishing, asyncGoes live, rules run, a hit returns it to pending
externalBefore publishing, syncCalls an external service; falls back to async when unavailable
manualAt publish timeWaits in the queue until a human approves

async only queues content — the final call belongs to a person. external returning block fails the API call while recording it; flag / replace leave the item pending. The old boolean post_approval applies only while moderation_mode was never stored, as manual.

POST /api/v1/admin/moderation/pending lists the queue; /moderation/{id}/approve and /reject decide. Both take the record id, not the post id.

FieldContents
target_type / target_idPost or comment, plus its id; status is pending/approved/rejected/auto_pass
action / strategyallow/block/replace/flag, and origin manual/async/external/gate/tl0
matched_rulesHit rules as JSON; original_body / filtered_body hold both texts
reviewer_id / reviewed_atWho decided, and when

Every pending item creates a record, or the queue would be empty.

POST /api/v1/reports/create (10/min per IP) files a report, managed in /admin/reports with statuses pending, resolved, dismissed. Reports never change content state themselves.

MechanismStored asEffect
Mutebanned rows, global or spaceGlobal mutes are rejected at login (1015); existing sessions get 404 on protected endpoints
Banrole banLogin refused, and the role change revokes every session

Mutes are is_permanent=true or temporary via duration_minutes / expires_at. Space-scoped mutes block writes in that space; a global mute blocks protected endpoints while public content stays readable. Use /api/v1/user/{id}/banned and /unbanned, plus /user/{id}/space/{space_id}/banned.

Spaces carry spaces.visibility (public, login, level) plus spaces.min_level.

ValueWho can read
publicEveryone, including guests (counted as TL0)
loginSigned-in users; equivalent to level 1
levelUsers at or above min_level

The effective policy is the strictest along the ancestry chain: children inherit from parents, multiple level ancestors resolve to the highest min_level, and posts.min_level overrides by taking the higher of the two.

All six content exits share one predicate — list, detail, search, sitemap, RSS, batch — so “invisible in the list but readable by URL” cannot happen. Detail returns 403 with “requires level X, you are Y”; authors always see their own posts, reviewers with report:manage bypass the gate, and level spaces stay out of the sitemap.

Rules at /admin/gates are priority + domain + conditions (JSON array) + action over five domains: content_view, post_create, comment_create, external_link, rate_limit, each with an explicit default action (links default to deny).

PredicatesOperators
level, xp, author_level / space_id, tagnumeric comparisons / eq ne in
is_author, is_anonymous, email_verified, banned, exiled, contains_external_linkeq
window_metricactive_days, post_count, likes_received, report_upheld (numeric)

Actions are only allow, deny, require_review, rate_limit. Evaluation runs in descending priority, first hit wins; priorities are unique per domain, conditions AND, empty never matches.

Two link rules are seeded (TL0 denied, level ≥1 allowed), showing “default deny plus explicit allow”. The admin “simulate as user” action runs the production evaluator, so verdicts match real requests, and every hit logs trace id, domain, action, rule, priority.

API keys and MCP tools follow the same mode and gate path; the forced-draft rule lives only in Site Customization.

终端窗口
# Publish a post and inspect its status
curl -s -X POST http://localhost:8080/api/v1/posts/create \
-H 'Authorization: Bearer <sid>' -H 'Content-Type: application/json' \
-d '{"title":"hello","content":"first post","space_id":""}' | jq '.data.status'

Under manual it returns pending; under off or async, approved. Read the mode with POST /api/v1/admin/settings/moderation_mode — it is not a public setting.

SymptomCauseFix
Post succeeds but is invisiblemanual mode, or a gate’s require_reviewReview in /admin/moderation; simulate the user in /admin/gates
A post disappears under asyncAsync rules hit and moved it to pendingExpected; approving restores it
external mode feels slowIt calls the service synchronouslyExpected; switch back to async
A rule save says the priority is takenDuplicate priority inside one domainPick another number