fix: Fixes AV moderation used in tenants.

This commit is contained in:
Дамян Минков 2021-08-20 13:17:12 -05:00
parent e63b3016c9
commit e2f760c7f1
1 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,7 @@
local get_room_by_name_and_subdomain = module:require 'util'.get_room_by_name_and_subdomain;
local is_healthcheck_room = module:require 'util'.is_healthcheck_room;
local internal_room_jid_match_rewrite = module:require "util".internal_room_jid_match_rewrite;
local room_jid_match_rewrite = module:require "util".room_jid_match_rewrite;
local json = require 'util.json';
local st = require 'util.stanza';
@ -30,7 +32,7 @@ function notify_occupants_enable(jid, enable, room, actorJid, mediaType)
local body_json = {};
body_json.type = 'av_moderation';
body_json.enabled = enable;
body_json.room = room.jid;
body_json.room = internal_room_jid_match_rewrite(room.jid);
body_json.actor = actorJid;
body_json.mediaType = mediaType;
local body_json_str = json.encode(body_json);
@ -52,7 +54,7 @@ end
function notify_whitelist_change(jid, moderators, room, mediaType)
local body_json = {};
body_json.type = 'av_moderation';
body_json.room = room.jid;
body_json.room = internal_room_jid_match_rewrite(room.jid);
body_json.whitelists = room.av_moderation;
local moderators_body_json_str = json.encode(body_json);
body_json.whitelists = nil;
@ -168,8 +170,7 @@ function on_message(event)
local occupant_jid = moderation_command.attr.jidToWhitelist;
-- check if jid is in the room, if so add it to whitelist
-- inform all moderators and admins and the jid
local occupant_to_add = room:get_occupant_by_nick(occupant_jid);
local occupant_to_add = room:get_occupant_by_nick(room_jid_match_rewrite(occupant_jid));
if not occupant_to_add then
module:log('warn', 'No occupant %s found for %s', occupant_jid, room.jid);
return false;