Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s
mod/decision->activity maps a decision to a moderation verb (remove→Delete, ban→Block, hide/escalate→Flag, keep→no activity) shaped like an AP activity, preserving the precise action. mod/decisions->activities batch-exports dropping keeps. With wire (Ext 14) + fed trust (Phase 4) the federated moderation path is end-to-end: decide → activity/wire → peer → trust-gate → apply. +17 tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
;; lib/mod/activity.sx — export decisions as ActivityPub-shaped events.
|
|
;;
|
|
;; The rose-ash platform propagates cross-domain effects as ActivityPub-shaped
|
|
;; activities. A moderation decision maps to a moderation verb so the rest of the
|
|
;; platform (and federated peers) can act on it: remove→Delete, ban→Block,
|
|
;; hide/escalate→Flag, keep→no activity. The precise mod action is preserved in
|
|
;; :action so a consumer can disambiguate (e.g. hide vs escalate, both Flag).
|
|
|
|
(define
|
|
mod/action->verb
|
|
(fn
|
|
(action)
|
|
(cond
|
|
((= action "remove") "Delete")
|
|
((= action "ban") "Block")
|
|
((= action "hide") "Flag")
|
|
((= action "escalate") "Flag")
|
|
(true nil))))
|
|
|
|
(define
|
|
mod/decision->activity
|
|
(fn
|
|
(d actor)
|
|
(let
|
|
((verb (mod/action->verb (get d :action))))
|
|
(if (nil? verb) nil {:type verb :action (get d :action) :actor actor :summary (str "moderation/" (get d :action) " via " (get d :rule)) :object (get d :report-id) :rule (get d :rule)}))))
|
|
|
|
;; map a batch of decisions to activities, dropping the no-op keeps
|
|
(define
|
|
mod/decisions->activities
|
|
(fn
|
|
(decisions actor)
|
|
(reduce
|
|
(fn
|
|
(acc d)
|
|
(let
|
|
((a (mod/decision->activity d actor)))
|
|
(if (nil? a) acc (append acc (list a)))))
|
|
(list)
|
|
decisions)))
|