diff --git a/bigbluebutton-html5/imports/ui/components/app/component.jsx b/bigbluebutton-html5/imports/ui/components/app/component.jsx index f26cedbe62..d23be3814a 100755 --- a/bigbluebutton-html5/imports/ui/components/app/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/app/component.jsx @@ -46,6 +46,7 @@ import LayoutService from '/imports/ui/components/layout/service'; import { registerTitleView } from '/imports/utils/dom-utils'; import GlobalStyles from '/imports/ui/stylesheets/styled-components/globalStyles'; import MediaService from '/imports/ui/components/media/service'; +import { toast } from 'react-toastify'; const MOBILE_MEDIA = 'only screen and (max-width: 40em)'; const APP_CONFIG = Meteor.settings.public.app; @@ -128,6 +129,8 @@ const defaultProps = { const isLayeredView = window.matchMedia(`(max-width: ${SMALL_VIEWPORT_BREAKPOINT}px)`); +let publishedPollToast = null; + class App extends Component { static renderWebcamsContainer() { return ; @@ -252,6 +255,7 @@ class App extends Component { pushLayoutToEveryone, // is layout pushed layoutContextDispatch, mountRandomUserModal, + ignorePollNotifications, } = this.props; if (meetingLayout !== prevProps.meetingLayout) { @@ -313,10 +317,11 @@ class App extends Component { intl.formatMessage(intlMessages.meetingMuteOff), 'info', 'unmute', ); } - if (!prevProps.hasPublishedPoll && hasPublishedPoll) { - notify( + if (!prevProps.hasPublishedPoll && hasPublishedPoll && !ignorePollNotifications) { + const id = notify( intl.formatMessage(intlMessages.pollPublishedLabel), 'info', 'polling', ); + if (id) publishedPollToast = id; } if (prevProps.currentUserRole === VIEWER && currentUserRole === MODERATOR) { notify( @@ -330,6 +335,8 @@ class App extends Component { } if (deviceType === null || prevProps.deviceType !== deviceType) this.throttledDeviceType(); + + if (ignorePollNotifications && publishedPollToast) toast.dismiss(publishedPollToast); } componentWillUnmount() { diff --git a/bigbluebutton-html5/imports/ui/components/app/container.jsx b/bigbluebutton-html5/imports/ui/components/app/container.jsx index 844d07e43f..7374dc0d17 100755 --- a/bigbluebutton-html5/imports/ui/components/app/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/app/container.jsx @@ -250,6 +250,7 @@ export default injectIntl(withModalMounter(withTracker(({ intl, baseControls }) autoSwapLayout: getFromUserSettings('bbb_auto_swap_layout', LAYOUT_CONFIG.autoSwapLayout), hideActionsBar: getFromUserSettings('bbb_hide_actions_bar', false), isModalOpen: !!getModal(), + ignorePollNotifications: Session.get('ignorePollNotifications'), }; })(AppContainer))); diff --git a/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx index 5e7391dc88..115704392b 100644 --- a/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx @@ -10,6 +10,7 @@ import { stripTags, unescapeHtml } from '/imports/utils/string-utils'; import Service from '../service'; import Styled from './styles'; import { usePreviousValue } from '/imports/ui/components/utils/hooks'; +import { Session } from 'meteor/session'; const CHAT_CONFIG = Meteor.settings.public.chat; const PUBLIC_CHAT_CLEAR = CHAT_CONFIG.chat_clear; @@ -193,9 +194,11 @@ const ChatAlert = (props) => { const mappedMessage = Service.mapGroupMessage(timeWindow); let content = null; + let isPollResult = false; if (mappedMessage) { if (mappedMessage.id.includes(POLL_RESULT_KEY)) { content = createPollMessage(); + isPollResult = true; } else { content = createMessage(mappedMessage.sender.name, mappedMessage.content.slice(-5)); } @@ -218,10 +221,22 @@ const ChatAlert = (props) => { : {intl.formatMessage(intlMessages.appToastChatPrivate)} } onOpen={ - () => setUnreadMessages(newUnreadMessages) + () => { + if (isPollResult) { + Session.set('ignorePollNotifications', true); + } + + setUnreadMessages(newUnreadMessages); + } } onClose={ - () => setUnreadMessages(newUnreadMessages) + () => { + if (isPollResult) { + Session.set('ignorePollNotifications', false); + } + + setUnreadMessages(newUnreadMessages); + } } alertDuration={timeWindow.durationDiff} layoutContextDispatch={layoutContextDispatch}