Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix: Adds display name to notifications about lobby operations.

damenchoddc2b4f26ea9
diff --git a/react/features/lobby/functions.js b/react/features/lobby/functions.js
index 3db19489e7..151c933405 100644
--- a/react/features/lobby/functions.js
+++ b/react/features/lobby/functions.js
@@ -1,23 +1,6 @@
// @flow
import { getCurrentConference } from '../base/conference';
-import { toState } from '../base/redux';
-
-const JID_PATTERN = '[^@]+@[^/]+/(.+)';
-
-/**
- * Returns a knocking participant by ID or JID.
- *
- * @param {Function | Object} stateful - The Redux state or a function that resolves to the Redux state.
- * @param {string} id - The ID or JID of the participant.
- * @returns {Object}
- */
-export function getKnockingParticipantById(stateful: Function | Object, id: string): Object {
- const { knockingParticipants } = toState(stateful)['features/lobby'];
- const idToFind = getIdFromJid(id) || id;
-
- return knockingParticipants.find(p => p.id === idToFind);
-}
/**
* Approves (lets in) or rejects a knocking participant.
@@ -38,15 +21,3 @@ export function setKnockingParticipantApproval(getState: Function, id: string, a
}
}
}
-
-/**
- * Parses an ID from a JID, if a JID is provided, undefined otherwise.
- *
- * @param {string} jid - The JID to get the ID from.
- * @returns {?string}
- */
-function getIdFromJid(jid: string): ?string {
- const match = new RegExp(JID_PATTERN, 'g').exec(jid) || [];
-
- return match[1];
-}
diff --git a/react/features/lobby/middleware.js b/react/features/lobby/middleware.js
index da974bcecf..e21eaf3107 100644
--- a/react/features/lobby/middleware.js
+++ b/react/features/lobby/middleware.js
@@ -17,7 +17,6 @@ import {
startKnocking,
setPasswordJoinFailed
} from './actions';
-import { getKnockingParticipantById } from './functions';
MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
@@ -176,7 +175,8 @@ function _maybeSendLobbyNotification(origin, message, { dispatch, getState }) {
const notificationProps: any = {
descriptionArguments: {
- originParticipantName: getParticipantDisplayName(getState, origin._id)
+ originParticipantName: getParticipantDisplayName(getState, origin._id),
+ targetParticipantName: message.name
},
titleKey: 'lobby.notificationTitle'
};
@@ -187,13 +187,9 @@ function _maybeSendLobbyNotification(origin, message, { dispatch, getState }) {
break;
case 'LOBBY-ACCESS-GRANTED':
notificationProps.descriptionKey = 'lobby.notificationLobbyAccessGranted';
- notificationProps.descriptionArguments.targetParticipantName
- = getKnockingParticipantById(getState, message.value)?.name;
break;
case 'LOBBY-ACCESS-DENIED':
notificationProps.descriptionKey = 'lobby.notificationLobbyAccessDenied';
- notificationProps.descriptionArguments.targetParticipantName
- = getKnockingParticipantById(getState, message.value)?.name;
break;
}
diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.lua
index 63cd558357..fe1f3ac480 100644
--- a/resources/prosody-plugins/mod_muc_lobby_rooms.lua
+++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua
@@ -101,9 +101,10 @@ end
-- Sends a json message notifying that the jid was granted/denied access in lobby
-- the message from is the actor that did the operation
-function notify_lobby_access(room, actor, jid, granted)
+function notify_lobby_access(room, actor, jid, display_name, granted)
local notify_json = {
- value = jid
+ value = jid,
+ name = display_name
};
if granted then
notify_json.event = NOTIFY_LOBBY_ACCESS_GRANTED;
@@ -234,8 +235,10 @@ function process_lobby_muc_loaded(lobby_muc, host_module)
host_module:hook('muc-broadcast-presence', function (event)
local actor, occupant, room, x = event.actor, event.occupant, event.room, event.x;
if check_status(x, '307') then
+ local display_name = occupant:get_presence():get_child_text(
+ 'nick', 'http://jabber.org/protocol/nick');
-- we need to notify in the main room
- notify_lobby_access(room.main_room, actor, occupant.nick, false);
+ notify_lobby_access(room.main_room, actor, occupant.nick, display_name, false);
end
end);
end
@@ -362,7 +365,10 @@ process_host_module(main_muc_component_config, function(host_module, host)
if room._data.lobbyroom then
local occupant = room._data.lobbyroom:get_occupant_by_real_jid(invitee);
if occupant then
- notify_lobby_access(room, from, occupant.nick, true);
+ local display_name = occupant:get_presence():get_child_text(
+ 'nick', 'http://jabber.org/protocol/nick');
+
+ notify_lobby_access(room, from, occupant.nick, display_name, true);
end
end
end);
@@ -396,4 +402,4 @@ end
module:hook_global('bosh-session', update_session);
module:hook_global('websocket-session', update_session);
module:hook_global('config-reloaded', load_config);
-module:hook_global('create-lobby-room', handle_create_lobby);
\ No newline at end of file
+module:hook_global('create-lobby-room', handle_create_lobby);