# HG changeset patch # User John Livingston # Date 1722249319 -7200 # Node ID 5076b78c95ef07f2cbda1c762a62733be29478e4 # Parent 5ccc03c331581986eb8b5193882afbb3f2feb84c mod_muc_moderation: Fix occupant-id placement in moderated tombstone. diff -r 5ccc03c33158 -r 5076b78c95ef mod_muc_moderation/mod_muc_moderation.lua --- a/mod_muc_moderation/mod_muc_moderation.lua Fri Jul 26 18:22:30 2024 +0200 +++ b/mod_muc_moderation/mod_muc_moderation.lua Mon Jul 29 12:35:19 2024 +0200 @@ -107,27 +107,27 @@ announcement:add_direct_child(moderated_occupant_id); end + announcement:reset(); + 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() }); - - if room.get_occupant_id then - 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); - end - end + :tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }):up(); if reason then tombstone:text_tag("reason", reason); end + + if room.get_occupant_id then + if actor_occupant then + tombstone:add_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })); + end + + if moderated_occupant_id then + -- Copy occupant id from moderated message + tombstone:add_direct_child(moderated_occupant_id); + end + end tombstone:reset(); local was_replaced = muc_log_archive:set(room_node, stanza_id, tombstone);