Skip to content

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

feat: Edits messages display name on breakout info received. Fixes #10671.

Дамян Минков1c4283eecabd
diff --git a/react/features/breakout-rooms/middleware.js b/react/features/breakout-rooms/middleware.js
index d3f3d3777d..88b611a89d 100644
--- a/react/features/breakout-rooms/middleware.js
+++ b/react/features/breakout-rooms/middleware.js
@@ -1,10 +1,13 @@
// @flow
import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
-import { StateListenerRegistry } from '../base/redux';
+import { getParticipantById } from '../base/participants';
+import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
+import { editMessage, MESSAGE_TYPE_REMOTE } from '../chat';
import { UPDATE_BREAKOUT_ROOMS } from './actionTypes';
import { moveToRoom } from './actions';
+import { getBreakoutRooms } from './functions';
import logger from './logger';
/**
@@ -30,3 +33,37 @@ StateListenerRegistry.register(
});
}
});
+
+MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
+ const { type } = action;
+ const result = next(action);
+
+ switch (type) {
+ case UPDATE_BREAKOUT_ROOMS: {
+ const { messages } = getState()['features/chat'];
+
+ // edit the chat history to match names for participants in breakout rooms
+ messages && messages.forEach(m => {
+ if (m.messageType === MESSAGE_TYPE_REMOTE && !getParticipantById(getState(), m.id)) {
+ const rooms = getBreakoutRooms(getState);
+
+ for (const room of Object.values(rooms)) {
+ // $FlowExpectedError
+ const participants = room.participants || {};
+ const matchedJid = Object.keys(participants).find(jid => jid.endsWith(m.id));
+
+ if (matchedJid) {
+ m.displayName = participants[matchedJid].displayName;
+
+ dispatch(editMessage(m));
+ }
+ }
+ }
+ });
+
+ break;
+ }
+ }
+
+ return result;
+});