浏览代码

fix: Fixes AV moderation used in tenants.

master
Дамян Минков 3 年前
父节点
当前提交
e2f760c7f1
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5
    4
      resources/prosody-plugins/mod_av_moderation_component.lua

+ 5
- 4
resources/prosody-plugins/mod_av_moderation_component.lua 查看文件

@@ -1,5 +1,7 @@
1 1
 local get_room_by_name_and_subdomain = module:require 'util'.get_room_by_name_and_subdomain;
2 2
 local is_healthcheck_room = module:require 'util'.is_healthcheck_room;
3
+local internal_room_jid_match_rewrite = module:require "util".internal_room_jid_match_rewrite;
4
+local room_jid_match_rewrite = module:require "util".room_jid_match_rewrite;
3 5
 local json = require 'util.json';
4 6
 local st = require 'util.stanza';
5 7
 
@@ -30,7 +32,7 @@ function notify_occupants_enable(jid, enable, room, actorJid, mediaType)
30 32
     local body_json = {};
31 33
     body_json.type = 'av_moderation';
32 34
     body_json.enabled = enable;
33
-    body_json.room = room.jid;
35
+    body_json.room = internal_room_jid_match_rewrite(room.jid);
34 36
     body_json.actor = actorJid;
35 37
     body_json.mediaType = mediaType;
36 38
     local body_json_str = json.encode(body_json);
@@ -52,7 +54,7 @@ end
52 54
 function notify_whitelist_change(jid, moderators, room, mediaType)
53 55
     local body_json = {};
54 56
     body_json.type = 'av_moderation';
55
-    body_json.room = room.jid;
57
+    body_json.room = internal_room_jid_match_rewrite(room.jid);
56 58
     body_json.whitelists = room.av_moderation;
57 59
     local moderators_body_json_str = json.encode(body_json);
58 60
     body_json.whitelists = nil;
@@ -168,8 +170,7 @@ function on_message(event)
168 170
             local occupant_jid = moderation_command.attr.jidToWhitelist;
169 171
             -- check if jid is in the room, if so add it to whitelist
170 172
             -- inform all moderators and admins and the jid
171
-            local occupant_to_add = room:get_occupant_by_nick(occupant_jid);
172
-
173
+            local occupant_to_add = room:get_occupant_by_nick(room_jid_match_rewrite(occupant_jid));
173 174
             if not occupant_to_add then
174 175
                 module:log('warn', 'No occupant %s found for %s', occupant_jid, room.jid);
175 176
                 return false;

正在加载...
取消
保存