Mercurial > prosody-modules
annotate mod_pubsub_forgejo/test.lua @ 6214:cc5c0f1dc89b
mod_muc_anonymize_moderation_actions: Fix mentioning Virtualhost for MUC, Compatibility section and License.
diff --git a/mod_muc_anonymize_moderation_actions/README.md b/mod_muc_anonymize_moderation_actions/README.md
--- a/mod_muc_anonymize_moderation_actions/README.md
+++ b/mod_muc_anonymize_moderation_actions/README.md
@@ -1,8 +1,10 @@
-<!--
-SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
-SPDX-License-Identifier: AGPL-3.0-only
--->
-# mod_muc_anonymize_moderation_actions
+---
+labels:
+- 'Stage-Alpha'
+summary: Anonymize moderator actions for participants
+---
+
+## Introduction
This modules allows to anonymize affiliation and role changes in MUC rooms.
@@ -11,13 +13,10 @@ When the feature is enabled, when a mode
This is particularly usefull to prevent some revenge when a moderator bans someone.
-This module is under AGPL-3.0 license.
-
-It was tested on Prosody 0.12.x.
## Configuration
-Just enable the module on your MUC VirtualHost.
+Just enable the module on your MUC Component.
The feature will be accessible throught the room configuration form.
You can tweak the position of the settings in the MUC configuration form using `anonymize_moderation_actions_form_position`.
@@ -26,7 +25,20 @@ This value will be passed as priority fo
By default, the field will be between muc#roomconfig_changesubject and muc#roomconfig_moderatedroom (default value is `78`).
``` lua
-VirtualHost "muc.example.com"
+Component "muc.example.com" "muc"
modules_enabled = { "muc_anonymize_moderation_actions" }
anonymize_moderation_actions_form_position = 96
```
+
+## Compatibility
+
+ ------ ----------------------
+ trunk Works as of 25-05-12
+ 0.13 Works
+ 0.12 Works
+ ------ ----------------------
+
+### License
+
+SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
+SPDX-License-Identifier: AGPL-3.0-only
| author | Menel <menel@snikket.de> |
|---|---|
| date | Mon, 12 May 2025 10:42:26 +0200 |
| parents | 131b8bfbefb4 |
| children |
| rev | line source |
|---|---|
|
6175
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
1 -- CLI script to ease templates writing |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
2 -- must be launched with `lua test.lua` after setting the following env vars, |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
3 -- (assuming prosody has been clone in ../../prosody-0.12) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
4 -- LUA_CPATH=../../prosody-0.12/\?.so |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
5 -- LUA_PATH=../../prosody-0.12/\?.lua\;\?.lua |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
6 -- allow loading ".lib.lua" modules |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
7 local function loadlib(modulename) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
8 local filename = modulename .. ".lib.lua" |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
9 local file = io.open(filename, "rb") |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
10 if file then |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
11 return load(file:read("a")), modulename |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
12 else |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
13 return filename .. " not found" |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
14 end |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
15 end |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
16 |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
17 table.insert(package.searchers, loadlib) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
18 |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
19 local json = require "util.json" |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
20 local format = require "format" |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
21 local templates = require "templates" |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
22 |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
23 local function read_json(fname) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
24 local f = io.open(fname) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
25 assert(f ~= nil, fname) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
26 local data = json.decode(f:read("a")) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
27 f:close() |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
28 return data |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
29 end |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
30 |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
31 local function read_payload(dirname) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
32 return read_json("./webhook-examples/" .. dirname .. "/content.json") |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
33 end |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
34 |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
35 local function pprint(stanza) print(stanza:indent(1, " "):pretty_print()) end |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
36 |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
37 pprint(format(read_payload("push"), templates.push)) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
38 pprint(format(read_payload("pull_request"), templates.pull_request)) |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
39 -- pprint(format(read_payload("push_tag"), templates.push)) -- this is a push with 0 commits. It's ugly! |
|
131b8bfbefb4
mod_pubsub_forgejo: new module for forgejo webhooks
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
40 pprint(format(read_payload("release"), templates.release)) |
