Comparison

plugins/muc/muc.lib.lua @ 9718:81ef96368bff 0.11

MUC: Allow changing data attached to an only owner (fixes #1273) This previously prevented a single owner from setting their own nickname via admin query. The form method uses `true` as actor so it bypasses this check.
author Kim Alvefur <zash@zash.se>
date Thu, 20 Dec 2018 14:45:22 +0100
parent 9716:5281a795d6df
child 9719:941497cdefc3
child 9819:11671a2e07a9
comparison
equal deleted inserted replaced
9716:5281a795d6df 9718:81ef96368bff
1252 if actor == true then 1252 if actor == true then
1253 actor = nil -- So we can pass it safely to 'publicise_occupant_status' below 1253 actor = nil -- So we can pass it safely to 'publicise_occupant_status' below
1254 else 1254 else
1255 local actor_affiliation = self:get_affiliation(actor); 1255 local actor_affiliation = self:get_affiliation(actor);
1256 if actor_affiliation == "owner" then 1256 if actor_affiliation == "owner" then
1257 if jid_bare(actor) == jid then -- self change 1257 if jid_bare(actor) == jid and is_downgrade then -- self change
1258 -- need at least one owner 1258 -- need at least one owner
1259 local is_last = true; 1259 local is_last = true;
1260 for j in self:each_affiliation("owner") do 1260 for j in self:each_affiliation("owner") do
1261 if j ~= jid then is_last = false; break; end 1261 if j ~= jid then is_last = false; break; end
1262 end 1262 end