From e2f760c7f1aaad81950443a64185bfa97a82714b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 20 Aug 2021 13:17:12 -0500 Subject: [PATCH] fix: Fixes AV moderation used in tenants. --- .../prosody-plugins/mod_av_moderation_component.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/prosody-plugins/mod_av_moderation_component.lua b/resources/prosody-plugins/mod_av_moderation_component.lua index 7da59a0da..805d9fcaf 100644 --- a/resources/prosody-plugins/mod_av_moderation_component.lua +++ b/resources/prosody-plugins/mod_av_moderation_component.lua @@ -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;