diff --git a/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx
index e64baa02ea..006c6aea2b 100644
--- a/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx
@@ -68,8 +68,6 @@ const ChatAlert = (props) => {
unreadMessagesByChat,
intl,
layoutContextDispatch,
- chatsTracker,
- notify,
} = props;
const [unreadMessagesCount, setUnreadMessagesCount] = useState(0);
@@ -105,35 +103,6 @@ const ChatAlert = (props) => {
}
}, [pushAlertEnabled]);
- useEffect(() => {
- const keys = Object.keys(chatsTracker);
- keys.forEach((key) => {
- if (chatsTracker[key]?.shouldNotify) {
- if (audioAlertEnabled) {
- AudioService.playAlertSound(`${Meteor.settings.public.app.cdn
- + Meteor.settings.public.app.basename
- + Meteor.settings.public.app.instanceId}`
- + '/resources/sounds/notify.mp3');
- }
- if (pushAlertEnabled) {
- notify(
- key === 'MAIN-PUBLIC-GROUP-CHAT'
- ? intl.formatMessage(intlMessages.publicChatMsg)
- : intl.formatMessage(intlMessages.privateChatMsg),
- 'info',
- 'chat',
- { autoClose: 3000 },
-
-
{chatsTracker[key].lastSender}
-
-
,
- true,
- );
- }
- }
- });
- }, [chatsTracker]);
-
useEffect(() => {
if (pushAlertEnabled) {
const alertsObject = unreadMessagesByChat;
diff --git a/bigbluebutton-html5/imports/ui/components/chat/alert/container.jsx b/bigbluebutton-html5/imports/ui/components/chat/alert/container.jsx
index d7f832ab63..3420d560bb 100755
--- a/bigbluebutton-html5/imports/ui/components/chat/alert/container.jsx
+++ b/bigbluebutton-html5/imports/ui/components/chat/alert/container.jsx
@@ -1,7 +1,5 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
-import logger from '/imports/startup/client/logger';
-import Auth from '/imports/ui/services/auth';
import ChatAlert from './component';
import { layoutSelect, layoutSelectInput, layoutDispatch } from '../../layout/context';
import { PANELS } from '../../layout/enums';
@@ -18,15 +16,6 @@ const propTypes = {
pushAlertEnabled: PropTypes.bool.isRequired,
};
-// custom hook for getting previous value
-function usePrevious(value) {
- const ref = React.useRef();
- React.useEffect(() => {
- ref.current = value;
- });
- return ref.current;
-}
-
const ChatAlertContainer = (props) => {
const idChatOpen = layoutSelect((i) => i.idChatOpen);
const sidebarContent = layoutSelectInput((i) => i.sidebarContent);
@@ -65,47 +54,9 @@ const ChatAlertContainer = (props) => {
})
: null;
- const chatsTracker = {};
-
- if (usingChatContext.chats) {
- const chatsActive = Object.entries(usingChatContext.chats);
- chatsActive.forEach((c) => {
- try {
- if (c[0] === idChat || (c[0] === 'MAIN-PUBLIC-GROUP-CHAT' && idChat === 'public')) {
- chatsTracker[c[0]] = {};
- if (c[1]?.posJoinMessages || c[1]?.messageGroups) {
- const m = Object.entries(c[1]?.posJoinMessages || c[1]?.messageGroups);
- const sameUserCount = m.filter((message) => message[1]?.sender === Auth.userID).length;
- if (m[m.length - 1] && m[m.length - 1][1]?.sender !== Auth.userID) {
- chatsTracker[c[0]].lastSender = users[Auth.meetingID][c[1]?.lastSender]?.name;
- chatsTracker[c[0]].content = m[m.length - 1][1]?.message;
- chatsTracker[c[0]].count = m?.length - sameUserCount;
- }
- }
- }
- } catch (e) {
- logger.error({
- logCode: 'chat_alert_component_error',
- }, 'Error : ', e.error);
- }
- });
-
- const prevTracker = usePrevious(chatsTracker);
-
- if (prevTracker) {
- const keys = Object.keys(prevTracker);
- keys.forEach((key) => {
- if (chatsTracker[key]?.count > (prevTracker[key]?.count || 0)) {
- chatsTracker[key].shouldNotify = true;
- }
- });
- }
- }
-
return (
-
+
+ {description}
+
{ hasCheckbox ? (