Mercurial > prosody-modules
comparison mod_muc_moderation/mod_muc_moderation.lua @ 5943:5076b78c95ef
mod_muc_moderation: Fix occupant-id placement in moderated tombstone.
author | John Livingston <git@john-livingston.fr> |
---|---|
date | Mon, 29 Jul 2024 12:35:19 +0200 |
parents | 5ccc03c33158 |
children | 4b677e445b8a |
comparison
equal
deleted
inserted
replaced
5942:5ccc03c33158 | 5943:5076b78c95ef |
---|---|
105 local moderated_occupant_id = original:get_child("occupant-id", xmlns_occupant_id); | 105 local moderated_occupant_id = original:get_child("occupant-id", xmlns_occupant_id); |
106 if room.get_occupant_id and moderated_occupant_id then | 106 if room.get_occupant_id and moderated_occupant_id then |
107 announcement:add_direct_child(moderated_occupant_id); | 107 announcement:add_direct_child(moderated_occupant_id); |
108 end | 108 end |
109 | 109 |
110 announcement:reset(); | |
111 | |
110 if muc_log_archive.set and retract then | 112 if muc_log_archive.set and retract then |
111 local tombstone = st.message({ from = original.attr.from, type = "groupchat", id = original.attr.id }) | 113 local tombstone = st.message({ from = original.attr.from, type = "groupchat", id = original.attr.id }) |
112 :tag("moderated", { xmlns = xmlns_moderate, by = actor_nick }) | 114 :tag("moderated", { xmlns = xmlns_moderate, by = actor_nick }) |
113 :tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }); | 115 :tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }):up(); |
114 | |
115 if room.get_occupant_id then | |
116 tombstone:add_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })); | |
117 end | |
118 | |
119 tombstone:up(); | |
120 | |
121 if room.get_occupant_id then | |
122 if moderated_occupant_id then | |
123 -- Copy occupant id from moderated message | |
124 tombstone:add_child(moderated_occupant_id); | |
125 end | |
126 end | |
127 | 116 |
128 if reason then | 117 if reason then |
129 tombstone:text_tag("reason", reason); | 118 tombstone:text_tag("reason", reason); |
119 end | |
120 | |
121 if room.get_occupant_id then | |
122 if actor_occupant then | |
123 tombstone:add_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })); | |
124 end | |
125 | |
126 if moderated_occupant_id then | |
127 -- Copy occupant id from moderated message | |
128 tombstone:add_direct_child(moderated_occupant_id); | |
129 end | |
130 end | 130 end |
131 tombstone:reset(); | 131 tombstone:reset(); |
132 | 132 |
133 local was_replaced = muc_log_archive:set(room_node, stanza_id, tombstone); | 133 local was_replaced = muc_log_archive:set(room_node, stanza_id, tombstone); |
134 if not was_replaced then | 134 if not was_replaced then |