Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat: Adds internal action for editing chat messages.
Дамян Минковc64d1a97c1c7
diff --git a/react/features/chat/actionTypes.js b/react/features/chat/actionTypes.jsindex 1c15cb479e..ad270820b7 100644--- a/react/features/chat/actionTypes.js+++ b/react/features/chat/actionTypes.js@@ -33,6 +33,16 @@ export const CLEAR_MESSAGES = 'CLEAR_MESSAGES';*/export const CLOSE_CHAT = 'CLOSE_CHAT';+/**+ * The type of the action which signals to edit chat message.+ *+ * {+ * type: EDIT_MESSAGE,+ * message: Object+ * }+ */+export const EDIT_MESSAGE = 'EDIT_MESSAGE';+/*** The type of the action which signals to display the chat panel.*diff --git a/react/features/chat/actions.any.js b/react/features/chat/actions.any.jsindex 92059d1d8e..3f3bbacc91 100644--- a/react/features/chat/actions.any.js+++ b/react/features/chat/actions.any.js@@ -4,6 +4,7 @@ import {ADD_MESSAGE,CLEAR_MESSAGES,CLOSE_CHAT,+ EDIT_MESSAGE,SEND_MESSAGE,SET_PRIVATE_MESSAGE_RECIPIENT,SET_IS_POLL_TAB_FOCUSED@@ -41,6 +42,23 @@ export function addMessage(messageDetails: Object) {};}+/**+ * Edits an existing chat message.+ *+ * @param {Object} message - The chat message to edit/override. The messages will be matched from the state+ * comparing the messageId.+ * @returns {{+ * type: EDIT_MESSAGE,+ * message: Object+ * }}+ */+export function editMessage(message: Object) {+ return {+ type: EDIT_MESSAGE,+ message+ };+}+/*** Clears the chat messages in Redux.*diff --git a/react/features/chat/middleware.js b/react/features/chat/middleware.jsindex cb4b28e0c3..1d91334533 100644--- a/react/features/chat/middleware.js+++ b/react/features/chat/middleware.js@@ -314,7 +314,7 @@ function _handleReceivedMessage({ dispatch, getState },// Provide a default for for the case when a message is being// backfilled for a participant that has left the conference.const participant = getParticipantById(state, id) || {};-console.error('receiveeeed from', id, 'breakout:', APP.store.getState()["features/breakout-rooms"]);+const localParticipant = getLocalParticipant(getState);const displayName = getParticipantDisplayName(state, id);const hasRead = participant.local || isChatOpen;diff --git a/react/features/chat/reducer.js b/react/features/chat/reducer.jsindex abb553883a..60426a904a 100644--- a/react/features/chat/reducer.js+++ b/react/features/chat/reducer.js@@ -1,16 +1,18 @@// @flow+import { v4 as uuidv4 } from 'uuid';+import { ReducerRegistry } from '../base/redux';import {ADD_MESSAGE,CLEAR_MESSAGES,CLOSE_CHAT,+ EDIT_MESSAGE,OPEN_CHAT,SET_PRIVATE_MESSAGE_RECIPIENT,SET_IS_POLL_TAB_FOCUSED} from './actionTypes';-import { v4 as uuidv4 } from 'uuid';const DEFAULT_STATE = {isOpen: false,@@ -65,6 +67,30 @@ ReducerRegistry.register('features/chat', (state = DEFAULT_STATE, action) => {messages: []};+ case EDIT_MESSAGE: {+ let found = false;+ const newMessage = action.message;+ const messages = state.messages.map(m => {+ if (m.messageId === newMessage.messageId) {+ found = true;++ return newMessage;+ }++ return m;+ });++ // no change+ if (!found) {+ return state;+ }++ return {+ ...state,+ messages+ };+ }+case SET_PRIVATE_MESSAGE_RECIPIENT:return {...state,