comparison mod_muc_moderation/mod_muc_moderation.lua @ 4750:98429b646bd4

mod_muc_moderation: Use reserved nickname as fallback When moderation is invoked from a JID that is not joined, the nickname is not known, but we should include it in the broadcast for transparency.
author Kim Alvefur <zash@zash.se>
date Sat, 06 Nov 2021 19:03:00 +0100
parents 3a7953a5ee5b
children 4665df54719d
comparison
equal deleted inserted replaced
4749:3a7953a5ee5b 4750:98429b646bd4
61 if valid_roles[role or "none"] < valid_roles.moderator then 61 if valid_roles[role or "none"] < valid_roles.moderator then
62 origin.send(st.error_reply(stanza, "auth", "forbidden", "You need a role of at least 'moderator'")); 62 origin.send(st.error_reply(stanza, "auth", "forbidden", "You need a role of at least 'moderator'"));
63 return true; 63 return true;
64 end 64 end
65 65
66 if not actor_nick then
67 local reserved_nickname = room:get_affiliation_data(jid.bare(actor), "reserved_nickname");
68 if reserved_nickname then
69 actor_nick = jid.join(room.jid, reserved_nickname);
70 end
71 end
72
66 -- Original stanza to base tombstone on 73 -- Original stanza to base tombstone on
67 local original, err; 74 local original, err;
68 if muc_log_archive.get then 75 if muc_log_archive.get then
69 original, err = muc_log_archive:get(room_node, stanza_id); 76 original, err = muc_log_archive:get(room_node, stanza_id);
70 else 77 else