# HG changeset patch # User John Livingston # Date 1722010950 -7200 # Node ID 5ccc03c331581986eb8b5193882afbb3f2feb84c # Parent d58e4c70feb2de4e9674c330e29bf8c61dedba2f mod_muc_moderation: Fix a regression. Actor occupant-id was not added under the moderated tag, but at the top level. diff -r d58e4c70feb2 -r 5ccc03c33158 mod_muc_moderation/mod_muc_moderation.lua --- a/mod_muc_moderation/mod_muc_moderation.lua Fri Jul 26 17:07:05 2024 +0200 +++ b/mod_muc_moderation/mod_muc_moderation.lua Fri Jul 26 18:22:30 2024 +0200 @@ -83,11 +83,17 @@ end end + local actor_occupant = room:get_occupant_by_real_jid(actor) or room:new_occupant(jid.bare(actor), actor_nick); local announcement = st.message({ from = room_jid, type = "groupchat", id = id.medium(), }) :tag("apply-to", { xmlns = xmlns_fasten, id = stanza_id }) :tag("moderated", { xmlns = xmlns_moderate, by = actor_nick }) + if room.get_occupant_id then + -- This isn't a regular broadcast message going through the events occupant_id.lib hooks so we do this here + announcement:add_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })); + end + if retract then announcement:tag("retract", { xmlns = xmlns_retract }):up(); end @@ -101,20 +107,18 @@ announcement:add_direct_child(moderated_occupant_id); end - local actor_occupant = room:get_occupant_by_real_jid(actor) or room:new_occupant(jid.bare(actor), actor_nick); - if room.get_occupant_id then - -- This isn't a regular broadcast message going through the events occupant_id.lib hooks so we do this here - announcement:add_direct_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })) - end - if muc_log_archive.set and retract then local tombstone = st.message({ from = original.attr.from, type = "groupchat", id = original.attr.id }) :tag("moderated", { xmlns = xmlns_moderate, by = actor_nick }) - :tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }):up(); + :tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }); if room.get_occupant_id then - tombstone:add_direct_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })) + tombstone:add_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })); + end + tombstone:up(); + + if room.get_occupant_id then if moderated_occupant_id then -- Copy occupant id from moderated message tombstone:add_child(moderated_occupant_id);