feat: add bbb_hide_notifications (#21415)

* feat(layout): add `hideNotificationToasts` to notifications bar
context

Adds the `hideNotificationToasts` property to the notifications bar
in the layout context, allowing the notification toasts to be
hidden when the property is set to `true`.

* feat(layout): add userdata `bbb_hide_notifications`

Introduces join userdata parameter `bbb_hide_notifications` that
prevents the rendering of all notification toasts in the client.
This commit is contained in:
Arthur B. Grossi 2024-10-22 17:43:00 -03:00 committed by GitHub
parent 8daeafeb0d
commit 5f6b8bc698
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 33 additions and 2 deletions

View File

@ -107,6 +107,7 @@ const intlMessages = defineMessages({
const propTypes = {
darkTheme: PropTypes.bool.isRequired,
hideNotificationToasts: PropTypes.bool.isRequired,
};
class App extends Component {
@ -251,6 +252,7 @@ class App extends Component {
intl,
pluginConfig,
genericMainContentId,
hideNotificationToasts,
} = this.props;
const {
@ -318,7 +320,7 @@ class App extends Component {
) : null}
<AudioCaptionsSpeechContainer />
{this.renderAudioCaptions()}
<PresentationUploaderToastContainer intl={intl} />
{ !hideNotificationToasts && <PresentationUploaderToastContainer intl={intl} /> }
<UploaderContainer />
<BreakoutJoinConfirmationContainerGraphQL />
<AudioContainer {...{
@ -328,7 +330,7 @@ class App extends Component {
setVideoPreviewModalIsOpen: this.setVideoPreviewModalIsOpen,
}}
/>
<ToastContainer rtl />
{ !hideNotificationToasts && <ToastContainer rtl /> }
<ChatAlertContainerGraphql />
<RaiseHandNotifier />
<ManyWebcamsNotifier />

View File

@ -54,6 +54,7 @@ const AppContainer = (props) => {
const captionsStyle = layoutSelectOutput((i) => i.captions);
const presentation = layoutSelectInput((i) => i.presentation);
const sharedNotesInput = layoutSelectInput((i) => i.sharedNotes);
const { hideNotificationToasts } = layoutSelectInput((i) => i.notificationsBar);
const setSpeechOptions = useSetSpeechOptions();
const { data: pinnedPadData } = useDeduplicatedSubscription(PINNED_PAD_SUBSCRIPTION);
@ -105,6 +106,8 @@ const AppContainer = (props) => {
shouldShowPresentation,
genericMainContentId: genericMainContent.genericContentId,
audioCaptions: <AudioCaptionsLiveContainer />,
hideNotificationToasts: hideNotificationToasts
|| getFromUserSettings('bbb_hide_notifications', false),
darkTheme,
}}
{...props}

View File

@ -205,6 +205,24 @@ const reducer = (state, action) => {
};
}
// NOTIFICATION TOASTS
case ACTIONS.SET_HIDE_NOTIFICATION_TOASTS: {
const { notificationsBar } = state.input;
if (notificationsBar.hideNotificationToasts === action.value) {
return state;
}
return {
...state,
input: {
...state.input,
notificationsBar: {
...notificationsBar,
hideNotificationToasts: action.value,
},
},
};
}
// NAV BAR
case ACTIONS.SET_HAS_NAVBAR: {

View File

@ -53,6 +53,7 @@ export const ACTIONS = {
SET_HAS_BANNER_BAR: 'setHasBannerBar',
SET_HAS_NOTIFICATIONS_BAR: 'setHasNotificationsBar',
SET_HIDE_NOTIFICATION_TOASTS: 'setHideNotificationToasts',
SET_HAS_NAVBAR: 'setHasNavBar',
SET_NAVBAR_OUTPUT: 'setNavBarOutput',

View File

@ -14,6 +14,7 @@ export const INITIAL_INPUT_STATE = {
},
notificationsBar: {
hasNotification: false,
hideNotificationToasts: false,
},
navBar: {
hasNavBar: true,

View File

@ -108,6 +108,7 @@ interface NavBar {
interface NotificationsBar {
hasNotification: boolean;
hideNotificationToasts: boolean;
}
interface Size {

View File

@ -109,6 +109,11 @@ const LayoutObserver: React.FC = () => {
value: !getFromUserSettings('bbb_hide_nav_bar', false),
});
layoutContextDispatch({
type: ACTIONS.SET_HIDE_NOTIFICATION_TOASTS,
value: getFromUserSettings('bbb_hide_notifications', false),
});
window.addEventListener('localeChanged', () => {
layoutContextDispatch({
type: ACTIONS.SET_IS_RTL,