From 86e295e9bc87d5bdc7b9e23473b4232419e59ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 12 Oct 2023 10:55:47 +0200 Subject: [PATCH] fix(conference) clear raised hands when conference changes Fixes: https://github.com/jitsi/jitsi-meet-sdk-samples/issues/175 --- react/features/base/participants/actionTypes.ts | 8 ++++++++ react/features/base/participants/actions.ts | 14 ++++++++++++++ react/features/base/participants/reducer.ts | 7 +++++++ react/features/conference/middleware.any.ts | 5 ++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/react/features/base/participants/actionTypes.ts b/react/features/base/participants/actionTypes.ts index 50040cf910c7..85d7eb396f11 100644 --- a/react/features/base/participants/actionTypes.ts +++ b/react/features/base/participants/actionTypes.ts @@ -203,6 +203,14 @@ export const SET_LOADABLE_AVATAR_URL = 'SET_LOADABLE_AVATAR_URL'; */ export const LOCAL_PARTICIPANT_RAISE_HAND = 'LOCAL_PARTICIPANT_RAISE_HAND'; +/** + * Clear the raise hand queue. + * { + * type: RAISE_HAND_CLEAR + * } + */ +export const RAISE_HAND_CLEAR = 'RAISE_HAND_CLEAR'; + /** * Updates participant in raise hand queue. * { diff --git a/react/features/base/participants/actions.ts b/react/features/base/participants/actions.ts index 650db59cda68..42fe6afe13d2 100644 --- a/react/features/base/participants/actions.ts +++ b/react/features/base/participants/actions.ts @@ -22,6 +22,7 @@ import { PARTICIPANT_SOURCES_UPDATED, PARTICIPANT_UPDATED, PIN_PARTICIPANT, + RAISE_HAND_CLEAR, RAISE_HAND_UPDATED, SCREENSHARE_PARTICIPANT_NAME_CHANGED, SET_LOADABLE_AVATAR_URL, @@ -629,6 +630,19 @@ export function raiseHand(enabled: boolean) { }; } +/** + * Clear the raise hand queue. + * + * @returns {{ +* type: RAISE_HAND_CLEAR +* }} +*/ +export function raiseHandClear() { + return { + type: RAISE_HAND_CLEAR + }; +} + /** * Update raise hand queue of participants. * diff --git a/react/features/base/participants/reducer.ts b/react/features/base/participants/reducer.ts index d08cba0b6b5a..92d8fce39909 100644 --- a/react/features/base/participants/reducer.ts +++ b/react/features/base/participants/reducer.ts @@ -13,6 +13,7 @@ import { PARTICIPANT_SOURCES_UPDATED, PARTICIPANT_UPDATED, PIN_PARTICIPANT, + RAISE_HAND_CLEAR, RAISE_HAND_UPDATED, SCREENSHARE_PARTICIPANT_NAME_CHANGED, SET_LOADABLE_AVATAR_URL @@ -465,6 +466,12 @@ ReducerRegistry.register('features/base/participants', return { ...state }; } + case RAISE_HAND_CLEAR: { + return { + ...state, + raisedHandsQueue: [] + }; + } case RAISE_HAND_UPDATED: { return { ...state, diff --git a/react/features/conference/middleware.any.ts b/react/features/conference/middleware.any.ts index 9131c39a4324..07a619d286c2 100644 --- a/react/features/conference/middleware.any.ts +++ b/react/features/conference/middleware.any.ts @@ -19,7 +19,7 @@ import { getLocalizedDateFormatter } from '../base/i18n/dateUtil'; import { translateToHTML } from '../base/i18n/functions'; import i18next from '../base/i18n/i18next'; import { browser } from '../base/lib-jitsi-meet'; -import { pinParticipant } from '../base/participants/actions'; +import { pinParticipant, raiseHandClear } from '../base/participants/actions'; import MiddlewareRegistry from '../base/redux/MiddlewareRegistry'; import StateListenerRegistry from '../base/redux/StateListenerRegistry'; import { SET_REDUCED_UI } from '../base/responsive-ui/actionTypes'; @@ -90,6 +90,9 @@ StateListenerRegistry.register( // remaining pinned, since it's not destroyed across runs. dispatch(pinParticipant(null)); + // Clear raised hands. + dispatch(raiseHandClear()); + // XXX I wonder if there is a better way to do this. At this stage // we do know what dialogs we want to keep but the list of those // we want to hide is a lot longer. Thus we take a bit of a shortcut