Browse Source

fix: Fixes AV moderation used in tenants.

master
Дамян Минков 3 years ago
parent
commit
e2f760c7f1
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      resources/prosody-plugins/mod_av_moderation_component.lua

+ 5
- 4
resources/prosody-plugins/mod_av_moderation_component.lua View File

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

Loading…
Cancel
Save