|
@@ -2,6 +2,7 @@ local get_room_by_name_and_subdomain = module:require 'util'.get_room_by_name_an
|
2
|
2
|
local is_healthcheck_room = module:require 'util'.is_healthcheck_room;
|
3
|
3
|
local internal_room_jid_match_rewrite = module:require "util".internal_room_jid_match_rewrite;
|
4
|
4
|
local room_jid_match_rewrite = module:require "util".room_jid_match_rewrite;
|
|
5
|
+local array = require "util.array";
|
5
|
6
|
local json = require 'util.json';
|
6
|
7
|
local st = require 'util.stanza';
|
7
|
8
|
|
|
@@ -68,11 +69,15 @@ function notify_whitelist_change(jid, moderators, room, mediaType, removed)
|
68
|
69
|
body_json.type = 'av_moderation';
|
69
|
70
|
body_json.room = internal_room_jid_match_rewrite(room.jid);
|
70
|
71
|
body_json.whitelists = room.av_moderation;
|
71
|
|
- body_json.removed = removed;
|
|
72
|
+ if removed then
|
|
73
|
+ body_json.removed = true;
|
|
74
|
+ end
|
72
|
75
|
body_json.mediaType = mediaType;
|
73
|
76
|
local moderators_body_json_str = json.encode(body_json);
|
74
|
77
|
body_json.whitelists = nil;
|
75
|
|
- body_json.approved = true; -- we want to send to participants only that they were approved to unmute
|
|
78
|
+ if not removed then
|
|
79
|
+ body_json.approved = true; -- we want to send to participants only that they were approved to unmute
|
|
80
|
+ end
|
76
|
81
|
local participant_body_json_str = json.encode(body_json);
|
77
|
82
|
|
78
|
83
|
for _, occupant in room:each_occupant() do
|
|
@@ -167,7 +172,7 @@ function on_message(event)
|
167
|
172
|
room.av_moderation = {};
|
168
|
173
|
room.av_moderation_actors = {};
|
169
|
174
|
end
|
170
|
|
- room.av_moderation[mediaType] = {};
|
|
175
|
+ room.av_moderation[mediaType] = array{};
|
171
|
176
|
room.av_moderation_actors[mediaType] = occupant.nick;
|
172
|
177
|
end
|
173
|
178
|
else
|
|
@@ -208,10 +213,10 @@ function on_message(event)
|
208
|
213
|
if room.av_moderation then
|
209
|
214
|
local whitelist = room.av_moderation[mediaType];
|
210
|
215
|
if not whitelist then
|
211
|
|
- whitelist = {};
|
|
216
|
+ whitelist = array{};
|
212
|
217
|
room.av_moderation[mediaType] = whitelist;
|
213
|
218
|
end
|
214
|
|
- table.insert(whitelist, occupant_jid);
|
|
219
|
+ whitelist:push(occupant_jid);
|
215
|
220
|
|
216
|
221
|
notify_whitelist_change(occupant_to_add.jid, true, room, mediaType, false);
|
217
|
222
|
|
|
@@ -236,7 +241,7 @@ function on_message(event)
|
236
|
241
|
if whitelist then
|
237
|
242
|
local index = get_index_in_table(whitelist, occupant_jid)
|
238
|
243
|
if(index) then
|
239
|
|
- table.remove(whitelist, index);
|
|
244
|
+ whitelist:pop(index);
|
240
|
245
|
notify_whitelist_change(occupant_to_remove.jid, true, room, mediaType, true);
|
241
|
246
|
end
|
242
|
247
|
end
|