comparison mod_muc_members_json/mod_muc_members_json.lua @ 5657:80abda15a1e9

mod_muc_members_json: Fix potential error when removing old affiliations Found this uncommitted change on a production server... The affiliation data may been `nil` at some point, triggering an error?
author Kim Alvefur <zash@zash.se>
date Tue, 19 Sep 2023 14:55:56 +0200
parents dd4df71166ea
children
comparison
equal deleted inserted replaced
5656:c20b77e5e032 5657:80abda15a1e9
78 muc:set_affiliation_data(member_jid, "hats", get_hats(member_info, muc_config)); 78 muc:set_affiliation_data(member_jid, "hats", get_hats(member_info, muc_config));
79 end 79 end
80 end 80 end
81 -- Remove affiliation from folk who weren't in the source data but previously were 81 -- Remove affiliation from folk who weren't in the source data but previously were
82 for jid, aff, data in muc:each_affiliation() do 82 for jid, aff, data in muc:each_affiliation() do
83 if not jids[jid] and data.source == module.name then 83 if not jids[jid] and data and data.source == module.name then
84 muc:set_affiliation(true, jid, "none", "imported membership lost"); 84 muc:set_affiliation(true, jid, "none", "imported membership lost");
85 end 85 end
86 end 86 end
87 end 87 end
88 end 88 end