Mercurial > prosody-modules
comparison mod_muc_moderation/mod_muc_moderation.lua @ 5942:5ccc03c33158
mod_muc_moderation: Fix a regression. Actor occupant-id was not added under the moderated tag, but at the top level.
| author | John Livingston <git@john-livingston.fr> |
|---|---|
| date | Fri, 26 Jul 2024 18:22:30 +0200 |
| parents | 2e30af180da5 |
| children | 5076b78c95ef |
comparison
equal
deleted
inserted
replaced
| 5941:d58e4c70feb2 | 5942:5ccc03c33158 |
|---|---|
| 81 else | 81 else |
| 82 return false, "wait", "internal-server-error"; | 82 return false, "wait", "internal-server-error"; |
| 83 end | 83 end |
| 84 end | 84 end |
| 85 | 85 |
| 86 local actor_occupant = room:get_occupant_by_real_jid(actor) or room:new_occupant(jid.bare(actor), actor_nick); | |
| 86 | 87 |
| 87 local announcement = st.message({ from = room_jid, type = "groupchat", id = id.medium(), }) | 88 local announcement = st.message({ from = room_jid, type = "groupchat", id = id.medium(), }) |
| 88 :tag("apply-to", { xmlns = xmlns_fasten, id = stanza_id }) | 89 :tag("apply-to", { xmlns = xmlns_fasten, id = stanza_id }) |
| 89 :tag("moderated", { xmlns = xmlns_moderate, by = actor_nick }) | 90 :tag("moderated", { xmlns = xmlns_moderate, by = actor_nick }) |
| 91 | |
| 92 if room.get_occupant_id then | |
| 93 -- This isn't a regular broadcast message going through the events occupant_id.lib hooks so we do this here | |
| 94 announcement:add_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })); | |
| 95 end | |
| 90 | 96 |
| 91 if retract then | 97 if retract then |
| 92 announcement:tag("retract", { xmlns = xmlns_retract }):up(); | 98 announcement:tag("retract", { xmlns = xmlns_retract }):up(); |
| 93 end | 99 end |
| 94 | 100 |
| 99 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); |
| 100 if room.get_occupant_id and moderated_occupant_id then | 106 if room.get_occupant_id and moderated_occupant_id then |
| 101 announcement:add_direct_child(moderated_occupant_id); | 107 announcement:add_direct_child(moderated_occupant_id); |
| 102 end | 108 end |
| 103 | 109 |
| 104 local actor_occupant = room:get_occupant_by_real_jid(actor) or room:new_occupant(jid.bare(actor), actor_nick); | |
| 105 if room.get_occupant_id then | |
| 106 -- This isn't a regular broadcast message going through the events occupant_id.lib hooks so we do this here | |
| 107 announcement:add_direct_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })) | |
| 108 end | |
| 109 | |
| 110 if muc_log_archive.set and retract then | 110 if muc_log_archive.set and retract then |
| 111 local tombstone = st.message({ from = original.attr.from, type = "groupchat", id = original.attr.id }) | 111 local tombstone = st.message({ from = original.attr.from, type = "groupchat", id = original.attr.id }) |
| 112 :tag("moderated", { xmlns = xmlns_moderate, by = actor_nick }) | 112 :tag("moderated", { xmlns = xmlns_moderate, by = actor_nick }) |
| 113 :tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }):up(); | 113 :tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }); |
| 114 | 114 |
| 115 if room.get_occupant_id then | 115 if room.get_occupant_id then |
| 116 tombstone:add_direct_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })) | 116 tombstone:add_child(st.stanza("occupant-id", { xmlns = xmlns_occupant_id; id = room:get_occupant_id(actor_occupant) })); |
| 117 end | |
| 117 | 118 |
| 119 tombstone:up(); | |
| 120 | |
| 121 if room.get_occupant_id then | |
| 118 if moderated_occupant_id then | 122 if moderated_occupant_id then |
| 119 -- Copy occupant id from moderated message | 123 -- Copy occupant id from moderated message |
| 120 tombstone:add_child(moderated_occupant_id); | 124 tombstone:add_child(moderated_occupant_id); |
| 121 end | 125 end |
| 122 end | 126 end |
