diff --git a/bigbluebutton-html5/imports/ui/components/app/component.jsx b/bigbluebutton-html5/imports/ui/components/app/component.jsx
index 155ac2901d..94a7b2440c 100755
--- a/bigbluebutton-html5/imports/ui/components/app/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/app/component.jsx
@@ -1,4 +1,4 @@
-import React, { Component, Fragment } from 'react';
+import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { throttle } from 'lodash';
import { defineMessages, injectIntl } from 'react-intl';
@@ -30,7 +30,7 @@ import NewWebcamContainer from '../webcam/container';
import PresentationPodsContainer from '../presentation-pod/container';
import { styles } from './styles';
import {
- LAYOUT_TYPE, DEVICE_TYPE, ACTIONS, PANELS,
+ LAYOUT_TYPE, DEVICE_TYPE, ACTIONS,
} from '../layout/enums';
import {
isMobile, isTablet, isTabletPortrait, isTabletLandscape, isDesktop,
@@ -44,7 +44,6 @@ import SidebarNavigationContainer from '../sidebar-navigation/container';
import SidebarContentContainer from '../sidebar-content/container';
import { makeCall } from '/imports/ui/services/api';
import ConnectionStatusService from '/imports/ui/components/connection-status/service';
-import { NAVBAR_HEIGHT } from '/imports/ui/components/layout/layout-manager/component';
const MOBILE_MEDIA = 'only screen and (max-width: 40em)';
const APP_CONFIG = Meteor.settings.public.app;
@@ -421,7 +420,7 @@ class App extends Component {
sidebarNavigationIsOpen,
sidebarContentIsOpen,
audioAlertEnabled,
- pushAlertEnabled
+ pushAlertEnabled,
} = this.props;
return (
@@ -460,7 +459,13 @@ class App extends Component {
- {(audioAlertEnabled || pushAlertEnabled) && }
+ {(audioAlertEnabled || pushAlertEnabled)
+ && (
+
+ )}
diff --git a/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx
index 86251fa0db..4d16e5624a 100644
--- a/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
-import { Meteor } from "meteor/meteor";
+import { Meteor } from 'meteor/meteor';
import { defineMessages, injectIntl } from 'react-intl';
import _ from 'lodash';
import AudioService from '/imports/ui/components/audio/service';
@@ -54,7 +54,7 @@ const ChatAlert = (props) => {
unreadMessagesCountByChat,
unreadMessagesByChat,
intl,
- newLayoutContextDispatch
+ newLayoutContextDispatch,
} = props;
const [unreadMessagesCount, setUnreadMessagesCount] = useState(0);
@@ -68,9 +68,9 @@ const ChatAlert = (props) => {
const unreadObject = JSON.parse(unreadMessagesCountByChat);
const unreadCount = document.hidden
- ? unreadObject.reduce((a, b) => a + b.unreadCounter, 0)
- : unreadObject.filter((chat) => chat.chatId !== idChatOpen)
- .reduce((a, b) => a + b.unreadCounter, 0);
+ ? unreadObject.reduce((a, b) => a + b.unreadCounter, 0)
+ : unreadObject.filter((chat) => chat.chatId !== idChatOpen)
+ .reduce((a, b) => a + b.unreadCounter, 0);
if (audioAlertEnabled && unreadCount > unreadMessagesCount) {
AudioService.playAlertSound(`${Meteor.settings.public.app.cdn
@@ -97,48 +97,43 @@ const ChatAlert = (props) => {
let timewindowsToAlert = [];
let filteredTimewindows = [];
- alertsObject.forEach(chat => {
+ alertsObject.forEach((chat) => {
filteredTimewindows = filteredTimewindows.concat(
- chat.filter(timeWindow => {
- return timeWindow.timestamp > alertEnabledTimestamp
- })
+ chat.filter((timeWindow) => timeWindow.timestamp > alertEnabledTimestamp),
);
- })
+ });
- filteredTimewindows.forEach(timeWindow => {
+ filteredTimewindows.forEach((timeWindow) => {
const durationDiff = ALERT_DURATION - (new Date().getTime() - timeWindow.timestamp);
- if(timeWindow.lastTimestamp > timeWindow.timestamp){
- // é update de uma timewindow ja enviada
- // verifica se lasttimestamp é maior que ultimo alert exibido desse chat
- if(durationDiff > 0 && timeWindow.lastTimestamp > (lastAlertTimestampByChat[timeWindow.chatId] || 0)){
- //remover outros timewindows com mesmo key
- timewindowsToAlert = timewindowsToAlert.filter(item => item.chatId !== timeWindow.chatId);
- const newTimeWindow = {...timeWindow};
+ if (timeWindow.lastTimestamp > timeWindow.timestamp) {
+ if (durationDiff > 0
+ && timeWindow.lastTimestamp > (lastAlertTimestampByChat[timeWindow.chatId] || 0)) {
+ timewindowsToAlert = timewindowsToAlert
+ .filter((item) => item.chatId !== timeWindow.chatId);
+ const newTimeWindow = { ...timeWindow };
newTimeWindow.durationDiff = durationDiff;
timewindowsToAlert.push(newTimeWindow);
- const newLastAlertTimestampByChat = {...lastAlertTimestampByChat};
- if(timeWindow.timestamp > (lastAlertTimestampByChat[timeWindow.chatId] || 0)){
+ const newLastAlertTimestampByChat = { ...lastAlertTimestampByChat };
+ if (timeWindow.timestamp > (lastAlertTimestampByChat[timeWindow.chatId] || 0)) {
newLastAlertTimestampByChat[timeWindow.chatId] = timeWindow.timestamp;
setLastAlertTimestampByChat(newLastAlertTimestampByChat);
}
}
- }else{
- // new timeWindow, display if newer than last alert + alert interval
- if(timeWindow.timestamp > (lastAlertTimestampByChat[timeWindow.chatId] || 0) + ALERT_INTERVAL){
- timewindowsToAlert = timewindowsToAlert.filter(item => item.chatId !== timeWindow.chatId);
- timewindowsToAlert.push(timeWindow);
-
- const newLastAlertTimestampByChat = {...lastAlertTimestampByChat};
- if(timeWindow.timestamp > (lastAlertTimestampByChat[timeWindow.chatId] || 0)){
- newLastAlertTimestampByChat[timeWindow.chatId] = timeWindow.timestamp;
- setLastAlertTimestampByChat(newLastAlertTimestampByChat);
- }
+ } else if (timeWindow.timestamp
+ > (lastAlertTimestampByChat[timeWindow.chatId] || 0) + ALERT_INTERVAL) {
+ timewindowsToAlert = timewindowsToAlert
+ .filter((item) => item.chatId !== timeWindow.chatId);
+ timewindowsToAlert.push(timeWindow);
+ const newLastAlertTimestampByChat = { ...lastAlertTimestampByChat };
+ if (timeWindow.timestamp > (lastAlertTimestampByChat[timeWindow.chatId] || 0)) {
+ newLastAlertTimestampByChat[timeWindow.chatId] = timeWindow.timestamp;
+ setLastAlertTimestampByChat(newLastAlertTimestampByChat);
}
}
- })
+ });
setUnreadMessages(timewindowsToAlert);
}
}, [unreadMessagesByChat]);
@@ -155,45 +150,49 @@ const ChatAlert = (props) => {
});
return contentMessage;
- }
-
- const createMessage = (name, message) => {
- return (
-
-
{name}
-
- {
- mapContentText(message)
+ };
+
+ const createMessage = (name, message) => (
+
+
{name}
+
+ {
+ mapContentText(message)
.reduce((acc, text) => [...acc, (
), text], [])
- }
-
+ }
- );
- }
+
+ );
return pushAlertEnabled
- ? unreadMessages.map(timeWindow => {
+ ? unreadMessages.map((timeWindow) => {
const mappedMessage = Service.mapGroupMessage(timeWindow);
- const content = mappedMessage ? createMessage(mappedMessage.sender.name, mappedMessage.content.slice(-5)) : null;
+ const content = mappedMessage
+ ? createMessage(mappedMessage.sender.name, mappedMessage.content.slice(-5))
+ : null;
- return content ?
{intl.formatMessage(intlMessages.appToastChatPublic)}
- : {intl.formatMessage(intlMessages.appToastChatPrivate)}
- }
- onOpen={
- () => {
- const newUnreadMessages = unreadMessages.filter(message => message.key !== mappedMessage.key);
- setUnreadMessages(newUnreadMessages);
- }
- }
- alertDuration={timeWindow.durationDiff || ALERT_DURATION}
- newLayoutContextDispatch={newLayoutContextDispatch}
- /> : null;
+ return content
+ ? (
+ {intl.formatMessage(intlMessages.appToastChatPublic)}
+ : {intl.formatMessage(intlMessages.appToastChatPrivate)}
+ }
+ onOpen={
+ () => {
+ const newUnreadMessages = unreadMessages
+ .filter((message) => message.key !== mappedMessage.key);
+ setUnreadMessages(newUnreadMessages);
+ }
+ }
+ alertDuration={timeWindow.durationDiff || ALERT_DURATION}
+ newLayoutContextDispatch={newLayoutContextDispatch}
+ />
+ ) : null;
})
: null;
};
diff --git a/bigbluebutton-html5/imports/ui/components/chat/alert/container.jsx b/bigbluebutton-html5/imports/ui/components/chat/alert/container.jsx
index 98fbae04f5..819f80e930 100755
--- a/bigbluebutton-html5/imports/ui/components/chat/alert/container.jsx
+++ b/bigbluebutton-html5/imports/ui/components/chat/alert/container.jsx
@@ -39,18 +39,18 @@ const ChatAlertContainer = (props) => {
// audio alerts
const unreadMessagesCountByChat = audioAlertEnabled
- ? JSON.stringify(activeChats.map(chat => {
- return {chatId: chat.chatId, unreadCounter: chat.unreadCounter};
- }))
- : null;
+ ? JSON.stringify(activeChats.map((chat) => ({
+ chatId: chat.chatId, unreadCounter: chat.unreadCounter,
+ })))
+ : null;
// push alerts
const unreadMessagesByChat = pushAlertEnabled
- ? JSON.stringify(activeChats.filter((chat) => chat.unreadCounter > 0).map(chat => {
- const chatId = (chat.chatId === 'public') ? PUBLIC_CHAT_ID : chat.chatId;
- return UnreadMessages.getUnreadMessages(chatId, groupChatsMessages);
- }))
- : null;
+ ? JSON.stringify(activeChats.filter((chat) => chat.unreadCounter > 0).map((chat) => {
+ const chatId = (chat.chatId === 'public') ? PUBLIC_CHAT_ID : chat.chatId;
+ return UnreadMessages.getUnreadMessages(chatId, groupChatsMessages);
+ }))
+ : null;
return (
0){
- toast.update(lastToast.id, { render: , autoClose: options.autoClose, ...toastProps });
- }else{
+ if (toast.isActive(lastToast.id)
+ && _.isEqual(lastToastProps.key, toastProps.key) && options?.autoClose > 0) {
+ toast.update(
+ lastToast.id,
+ {
+ render: ,
+ autoClose: options.autoClose,
+ ...toastProps,
+ },
+ );
+ } else {
const id = toast(, settings);
lastToast = { id, ...toastProps };