From ce5114afc9803a681cd40bf1d573e1f11590020f Mon Sep 17 00:00:00 2001 From: John Livingston Date: Mon, 29 Jul 2024 13:25:09 +0200 Subject: [PATCH] mod_muc_anonymize_moderation_actions: fix XEP-0425 v0.2.1 compliance. --- .../mod_muc_anonymize_moderation_actions.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/prosody-modules/mod_muc_anonymize_moderation_actions/mod_muc_anonymize_moderation_actions.lua b/prosody-modules/mod_muc_anonymize_moderation_actions/mod_muc_anonymize_moderation_actions.lua index dfb40e3c..89a41cc7 100644 --- a/prosody-modules/mod_muc_anonymize_moderation_actions/mod_muc_anonymize_moderation_actions.lua +++ b/prosody-modules/mod_muc_anonymize_moderation_actions/mod_muc_anonymize_moderation_actions.lua @@ -48,7 +48,11 @@ local function remove_moderate_actor(event) local moderated = announcement:find("{urn:xmpp:fasten:0}apply-to/{urn:xmpp:message-moderate:0}moderated"); if moderated then module:log("debug", "We must anonymize the moderation announcement for stanza %s", event.stanza_id); - moderated.attr.by = nil; + -- FIXME: XEP-0245 has changed. + -- urn:xmpp:message-moderate:0 requires a "by" attribute + -- urn:xmpp:message-moderate:1 do not require the "by" attribute + -- So, for now, settings the room jid, as we only implement urn:xmpp:message-moderate:0. + moderated.attr.by = room.jid; moderated:remove_children("occupant-id", "urn:xmpp:occupant-id:0"); end @@ -56,7 +60,11 @@ local function remove_moderate_actor(event) local moderated = tombstone:get_child("moderated", "urn:xmpp:message-moderate:0"); if moderated then module:log("debug", "We must anonymize the moderation tombstone for stanza %s", event.stanza_id); - moderated.attr.by = nil; + -- FIXME: XEP-0245 has changed. + -- urn:xmpp:message-moderate:0 requires a "by" attribute + -- urn:xmpp:message-moderate:1 do not require the "by" attribute + -- So, for now, settings the room jid, as we only implement urn:xmpp:message-moderate:0. + moderated.attr.by = room.jid; moderated:remove_children("occupant-id", "urn:xmpp:occupant-id:0"); end end