浏览代码

feat(visitors): Hide reactions.

factor2
Hristo Terezov 1年前
父节点
当前提交
a3bb1a3459

+ 3
- 3
react/features/reactions/components/web/RaiseHandContainerButtons.tsx 查看文件

@@ -4,17 +4,17 @@ import { useSelector } from 'react-redux';
4 4
 import { IReduxState } from '../../../app/types';
5 5
 import { isMobileBrowser } from '../../../base/environment/utils';
6 6
 import { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
7
-import { isReactionsButtonEnabled, isReactionsEnabled } from '../../functions.web';
7
+import { isReactionsButtonEnabled, shouldDisplayReactionsButtons } from '../../functions.web';
8 8
 
9 9
 import RaiseHandButton from './RaiseHandButton';
10 10
 import ReactionsMenuButton from './ReactionsMenuButton';
11 11
 
12 12
 const RaiseHandContainerButton = (props: AbstractButtonProps) => {
13 13
     const reactionsButtonEnabled = useSelector(isReactionsButtonEnabled);
14
-    const reactionsEnabled = useSelector(isReactionsEnabled);
14
+    const _shouldDisplayReactionsButtons = useSelector(shouldDisplayReactionsButtons);
15 15
     const isNarrowLayout = useSelector((state: IReduxState) => state['features/base/responsive-ui'].isNarrowLayout);
16 16
     const showReactionsAsPartOfRaiseHand
17
-        = !reactionsButtonEnabled && reactionsEnabled && !isNarrowLayout && !isMobileBrowser();
17
+        = _shouldDisplayReactionsButtons && !reactionsButtonEnabled && !isNarrowLayout && !isMobileBrowser();
18 18
 
19 19
     return showReactionsAsPartOfRaiseHand
20 20
         ? <ReactionsMenuButton

+ 2
- 9
react/features/reactions/components/web/ReactionsMenuButton.tsx 查看文件

@@ -10,7 +10,7 @@ import AbstractButton, { type IProps as AbstractButtonProps } from '../../../bas
10 10
 import ToolboxButtonWithPopup from '../../../base/toolbox/components/web/ToolboxButtonWithPopup';
11 11
 import { toggleReactionsMenuVisibility } from '../../actions.web';
12 12
 import { IReactionEmojiProps } from '../../constants';
13
-import { getReactionsQueue, isReactionsEnabled } from '../../functions.any';
13
+import { getReactionsQueue } from '../../functions.any';
14 14
 import { getReactionsMenuVisibility, isReactionsButtonEnabled } from '../../functions.web';
15 15
 import { IReactionsMenuParent } from '../../types';
16 16
 
@@ -30,11 +30,6 @@ interface IProps extends WithTranslation {
30 30
      */
31 31
     _reactionsButtonEnabled: boolean;
32 32
 
33
-    /**
34
-     * Whether or not the reactions are enabled.
35
-     */
36
-    _reactionsEnabled: boolean;
37
-
38 33
     /**
39 34
      * The button's key.
40 35
      */
@@ -93,7 +88,6 @@ const ReactionsButton = translate(connect()(ReactionsButtonImpl));
93 88
  */
94 89
 function ReactionsMenuButton({
95 90
     _reactionsButtonEnabled,
96
-    _reactionsEnabled,
97 91
     _isMobile,
98 92
     buttonKey,
99 93
     dispatch,
@@ -116,7 +110,7 @@ function ReactionsMenuButton({
116 110
         isOpen && toggleReactionsMenu();
117 111
     }, [ isOpen, toggleReactionsMenu ]);
118 112
 
119
-    if (!showRaiseHand && (!_reactionsButtonEnabled || !_reactionsEnabled)) {
113
+    if (!showRaiseHand && !_reactionsButtonEnabled) {
120 114
         return null;
121 115
     }
122 116
 
@@ -184,7 +178,6 @@ function mapStateToProps(state: IReduxState) {
184 178
 
185 179
     return {
186 180
         _reactionsButtonEnabled: isReactionsButtonEnabled(state),
187
-        _reactionsEnabled: isReactionsEnabled(state),
188 181
         _isMobile: isMobileBrowser(),
189 182
         isOpen: getReactionsMenuVisibility(state),
190 183
         isNarrow: isNarrowLayout,

+ 11
- 0
react/features/reactions/functions.any.ts 查看文件

@@ -5,6 +5,7 @@ import { REACTIONS_ENABLED } from '../base/flags/constants';
5 5
 import { getFeatureFlag } from '../base/flags/functions';
6 6
 import { getLocalParticipant } from '../base/participants/functions';
7 7
 import { extractFqnFromPath } from '../dynamic-branding/functions.any';
8
+import { iAmVisitor } from '../visitors/functions';
8 9
 
9 10
 import { IReactionEmojiProps, REACTIONS, ReactionThreshold, SOUNDS_THRESHOLDS } from './constants';
10 11
 import logger from './logger';
@@ -161,3 +162,13 @@ export function isReactionsEnabled(state: IReduxState): boolean {
161 162
 
162 163
     return !disableReactions;
163 164
 }
165
+
166
+/**
167
+ * Returns true if the reactions buttons should be displayed anywhere on the page and false otherwise.
168
+ *
169
+ * @param {IReduxState} state - The redux state.
170
+ * @returns {boolean}
171
+ */
172
+export function shouldDisplayReactionsButtons(state: IReduxState): boolean {
173
+    return isReactionsEnabled(state) && !iAmVisitor(state);
174
+}

+ 2
- 2
react/features/reactions/functions.web.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import { IReduxState } from '../app/types';
2 2
 import { getToolbarButtons } from '../base/config/functions.web';
3 3
 
4
-import { isReactionsEnabled } from './functions.any';
4
+import { shouldDisplayReactionsButtons } from './functions.any';
5 5
 
6 6
 export * from './functions.any';
7 7
 
@@ -22,5 +22,5 @@ export function getReactionsMenuVisibility(state: IReduxState): boolean {
22 22
  * @returns {boolean}
23 23
  */
24 24
 export function isReactionsButtonEnabled(state: IReduxState) {
25
-    return Boolean(getToolbarButtons(state).includes('reactions')) && isReactionsEnabled(state);
25
+    return Boolean(getToolbarButtons(state).includes('reactions')) && shouldDisplayReactionsButtons(state);
26 26
 }

+ 1
- 0
react/features/settings/functions.any.ts 查看文件

@@ -208,6 +208,7 @@ export function getNotificationsTabProps(stateful: IStateful, showSoundsSettings
208 208
         soundsTalkWhileMuted,
209 209
         soundsReactions
210 210
     } = state['features/base/settings'];
211
+
211 212
     const enableReactions = isReactionsEnabled(state);
212 213
     const moderatorMutedSoundsReactions = state['features/base/conference'].startReactionsMuted ?? false;
213 214
     const enabledNotifications = getNotificationsMap(stateful);

+ 15
- 12
react/features/toolbox/components/native/OverflowMenu.tsx 查看文件

@@ -12,7 +12,7 @@ import BreakoutRoomsButton
12 12
     from '../../../breakout-rooms/components/native/BreakoutRoomsButton';
13 13
 import SharedDocumentButton from '../../../etherpad/components/SharedDocumentButton.native';
14 14
 import ReactionMenu from '../../../reactions/components/native/ReactionMenu';
15
-import { isReactionsEnabled } from '../../../reactions/functions.any';
15
+import { shouldDisplayReactionsButtons } from '../../../reactions/functions.any';
16 16
 import LiveStreamButton from '../../../recording/components/LiveStream/native/LiveStreamButton';
17 17
 import RecordButton from '../../../recording/components/Recording/native/RecordButton';
18 18
 import SecurityDialogButton
@@ -52,15 +52,15 @@ interface IProps {
52 52
      */
53 53
     _isSpeakerStatsDisabled?: boolean;
54 54
 
55
-    /**
56
-     * Whether or not the reactions feature is enabled.
57
-     */
58
-    _reactionsEnabled: boolean;
59
-
60 55
     /**
61 56
      * Whether the recoding button should be enabled or not.
62
-     */
63
-    _recordingEnabled: boolean;
57
+    */
58
+   _recordingEnabled: boolean;
59
+
60
+   /**
61
+    * Whether or not any reactions buttons should be displayed.
62
+    */
63
+   _shouldDisplayReactionsButtons: boolean;
64 64
 
65 65
     /**
66 66
      * The width of the screen.
@@ -113,7 +113,7 @@ class OverflowMenu extends PureComponent<IProps, IState> {
113 113
         const {
114 114
             _isBreakoutRoomsSupported,
115 115
             _isSpeakerStatsDisabled,
116
-            _reactionsEnabled,
116
+            _shouldDisplayReactionsButtons,
117 117
             _width,
118 118
             dispatch
119 119
         } = this.props;
@@ -141,12 +141,15 @@ class OverflowMenu extends PureComponent<IProps, IState> {
141 141
 
142 142
         return (
143 143
             <BottomSheet
144
-                renderFooter = { _reactionsEnabled && !toolbarButtons.has('raisehand')
144
+                renderFooter = { _shouldDisplayReactionsButtons && !toolbarButtons.has('raisehand')
145 145
                     ? this._renderReactionMenu
146 146
                     : undefined }>
147 147
                 <OpenCarmodeButton { ...topButtonProps } />
148 148
                 <AudioOnlyButton { ...buttonProps } />
149
-                {!_reactionsEnabled && !toolbarButtons.has('raisehand') && <RaiseHandButton { ...buttonProps } />}
149
+                {
150
+                    !_shouldDisplayReactionsButtons && !toolbarButtons.has('raisehand')
151
+                        && <RaiseHandButton { ...buttonProps } />
152
+                }
150 153
                 {/* @ts-ignore */}
151 154
                 <Divider style = { styles.divider as ViewStyle } />
152 155
                 <SecurityDialogButton { ...buttonProps } />
@@ -206,7 +209,7 @@ function _mapStateToProps(state: IReduxState) {
206 209
     return {
207 210
         _isBreakoutRoomsSupported: conference?.getBreakoutRooms()?.isSupported(),
208 211
         _isSpeakerStatsDisabled: isSpeakerStatsDisabled(state),
209
-        _reactionsEnabled: isReactionsEnabled(state),
212
+        _shouldDisplayReactionsButtons: shouldDisplayReactionsButtons(state),
210 213
         _width: state['features/base/responsive-ui'].clientWidth
211 214
     };
212 215
 }

+ 6
- 6
react/features/toolbox/components/native/Toolbox.tsx 查看文件

@@ -8,7 +8,7 @@ import ColorSchemeRegistry from '../../../base/color-scheme/ColorSchemeRegistry'
8 8
 import Platform from '../../../base/react/Platform.native';
9 9
 import ChatButton from '../../../chat/components/native/ChatButton';
10 10
 import ReactionsMenuButton from '../../../reactions/components/native/ReactionsMenuButton';
11
-import { isReactionsEnabled } from '../../../reactions/functions.any';
11
+import { shouldDisplayReactionsButtons } from '../../../reactions/functions.any';
12 12
 import TileViewButton from '../../../video-layout/components/TileViewButton';
13 13
 import { iAmVisitor } from '../../../visitors/functions';
14 14
 import { getMovableButtons, isToolboxVisible } from '../../functions.native';
@@ -38,9 +38,9 @@ interface IProps {
38 38
     _iAmVisitor: boolean;
39 39
 
40 40
     /**
41
-     * Whether or not the reactions feature is enabled.
41
+     * Whether or not any reactions buttons should be visible.
42 42
      */
43
-    _reactionsEnabled: boolean;
43
+    _shouldDisplayReactionsButtons: boolean;
44 44
 
45 45
     /**
46 46
      * The color-schemed stylesheet of the feature.
@@ -65,7 +65,7 @@ interface IProps {
65 65
  * @returns {React$Element}.
66 66
  */
67 67
 function Toolbox(props: IProps) {
68
-    const { _endConferenceSupported, _reactionsEnabled, _styles, _visible, _iAmVisitor, _width } = props;
68
+    const { _endConferenceSupported, _shouldDisplayReactionsButtons, _styles, _visible, _iAmVisitor, _width } = props;
69 69
 
70 70
     if (!_visible) {
71 71
         return null;
@@ -114,7 +114,7 @@ function Toolbox(props: IProps) {
114 114
                 }
115 115
                 {!_iAmVisitor && additionalButtons.has('screensharing')
116 116
                     && <ScreenSharingButton styles = { buttonStylesBorderless } />}
117
-                {additionalButtons.has('raisehand') && (_reactionsEnabled && !_iAmVisitor
117
+                {additionalButtons.has('raisehand') && (_shouldDisplayReactionsButtons
118 118
                     ? <ReactionsMenuButton
119 119
                         styles = { buttonStylesBorderless }
120 120
                         toggledStyles = { backgroundToggledStyle } />
@@ -155,7 +155,7 @@ function _mapStateToProps(state: IReduxState) {
155 155
         _visible: isToolboxVisible(state),
156 156
         _iAmVisitor: iAmVisitor(state),
157 157
         _width: state['features/base/responsive-ui'].clientWidth,
158
-        _reactionsEnabled: isReactionsEnabled(state)
158
+        _shouldDisplayReactionsButtons: shouldDisplayReactionsButtons(state)
159 159
     };
160 160
 }
161 161
 

+ 12
- 12
react/features/toolbox/components/web/Toolbox.tsx 查看文件

@@ -16,7 +16,7 @@ import { isMobileBrowser } from '../../../base/environment/utils';
16 16
 import { translate } from '../../../base/i18n/functions';
17 17
 import { isLocalParticipantModerator } from '../../../base/participants/functions';
18 18
 import ContextMenu from '../../../base/ui/components/web/ContextMenu';
19
-import { isReactionsButtonEnabled, isReactionsEnabled } from '../../../reactions/functions.web';
19
+import { isReactionsButtonEnabled, shouldDisplayReactionsButtons } from '../../../reactions/functions.web';
20 20
 import { iAmVisitor } from '../../../visitors/functions';
21 21
 import {
22 22
     setHangupMenuVisible,
@@ -116,14 +116,14 @@ interface IProps extends WithTranslation {
116 116
     _reactionsButtonEnabled: boolean;
117 117
 
118 118
     /**
119
-     * Whether or not reactions feature is enabled.
119
+     * Whether the toolbox should be shifted up or not.
120 120
      */
121
-    _reactionsEnabled: boolean;
121
+    _shiftUp: boolean;
122 122
 
123 123
     /**
124
-     * Whether the toolbox should be shifted up or not.
124
+     * Whether any reactions buttons should be displayed or not.
125 125
      */
126
-    _shiftUp: boolean;
126
+    _shouldDisplayReactionsButtons: boolean;
127 127
 
128 128
     /**
129 129
      * The enabled buttons.
@@ -185,8 +185,8 @@ const Toolbox = ({
185 185
     _overflowDrawer,
186 186
     _overflowMenuVisible,
187 187
     _reactionsButtonEnabled,
188
-    _reactionsEnabled,
189 188
     _shiftUp,
189
+    _shouldDisplayReactionsButtons,
190 190
     _toolbarButtons,
191 191
     _visible,
192 192
     dispatch,
@@ -362,10 +362,11 @@ const Toolbox = ({
362 362
 
363 363
         const { mainMenuButtons, overflowMenuButtons } = getVisibleButtons();
364 364
         const raiseHandInOverflowMenu = overflowMenuButtons.some(({ key }) => key === 'raisehand');
365
-        const showReactionsInOverflowMenu
366
-            = (_reactionsEnabled && !_reactionsButtonEnabled
367
-                && (raiseHandInOverflowMenu || _isNarrowLayout || _isMobile))
368
-            || overflowMenuButtons.some(({ key }) => key === 'reactions');
365
+        const showReactionsInOverflowMenu = _shouldDisplayReactionsButtons
366
+            && (
367
+                (!_reactionsButtonEnabled && (raiseHandInOverflowMenu || _isNarrowLayout || _isMobile))
368
+                    || overflowMenuButtons.some(({ key }) => key === 'reactions')
369
+            );
369 370
         const showRaiseHandInReactionsMenu = showReactionsInOverflowMenu && raiseHandInOverflowMenu;
370 371
 
371 372
         return (
@@ -502,7 +503,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
502 503
     } = state['features/toolbox'];
503 504
     const { clientWidth } = state['features/base/responsive-ui'];
504 505
     let toolbarButtons = ownProps.toolbarButtons || getToolbarButtons(state);
505
-    const _reactionsEnabled = isReactionsEnabled(state);
506 506
 
507 507
     if (iAmVisitor(state)) {
508 508
         toolbarButtons = VISITORS_MODE_BUTTONS.filter(e => toolbarButtons.indexOf(e) > -1);
@@ -523,8 +523,8 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
523 523
         _overflowMenuVisible: overflowMenuVisible,
524 524
         _overflowDrawer: overflowDrawer,
525 525
         _reactionsButtonEnabled: isReactionsButtonEnabled(state),
526
-        _reactionsEnabled,
527 526
         _shiftUp: state['features/toolbox'].shiftUp,
527
+        _shouldDisplayReactionsButtons: shouldDisplayReactionsButtons(state),
528 528
         _toolbarButtons: toolbarButtons,
529 529
         _visible: isToolboxVisible(state)
530 530
     };

+ 6
- 4
react/features/toolbox/hooks.web.ts 查看文件

@@ -21,7 +21,7 @@ import { getParticipantsPaneOpen } from '../participants-pane/functions';
21 21
 import { addReactionToBuffer } from '../reactions/actions.any';
22 22
 import { toggleReactionsMenuVisibility } from '../reactions/actions.web';
23 23
 import { REACTIONS } from '../reactions/constants';
24
-import { isReactionsEnabled } from '../reactions/functions.any';
24
+import { shouldDisplayReactionsButtons } from '../reactions/functions.any';
25 25
 import { startScreenShareFlow } from '../screen-share/actions.web';
26 26
 import { isScreenVideoShared } from '../screen-share/functions';
27 27
 import SpeakerStats from '../speaker-stats/components/web/SpeakerStats';
@@ -36,6 +36,7 @@ import { isDesktopShareButtonDisabled } from './functions.web';
36 36
 export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {
37 37
     const dispatch = useDispatch();
38 38
     const _isSpeakerStatsDisabled = useSelector(isSpeakerStatsDisabled);
39
+    const _shouldDisplayReactionsButtons = useSelector(shouldDisplayReactionsButtons);
39 40
     const _toolbarButtons = useSelector((state: IReduxState) => toolbarButtons || getToolbarButtons(state));
40 41
     const chatOpen = useSelector((state: IReduxState) => state['features/chat'].isOpen);
41 42
     const desktopSharingButtonDisabled = useSelector(isDesktopShareButtonDisabled);
@@ -44,7 +45,6 @@ export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {
44 45
     const gifsEnabled = useSelector(isGifEnabled);
45 46
     const participantsPaneOpen = useSelector(getParticipantsPaneOpen);
46 47
     const raisedHand = useSelector((state: IReduxState) => hasRaisedHand(getLocalParticipant(state)));
47
-    const reactionsEnabled = useSelector(isReactionsEnabled);
48 48
     const screenSharing = useSelector(isScreenVideoShared);
49 49
     const tileViewEnabled = useSelector(shouldDisplayTileView);
50 50
 
@@ -253,7 +253,8 @@ export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {
253 253
             }
254 254
         });
255 255
 
256
-        if (reactionsEnabled) {
256
+        // If the buttons for sending reactions are not displayed we should disable the shortcuts too.
257
+        if (_shouldDisplayReactionsButtons) {
257 258
             const REACTION_SHORTCUTS = Object.keys(REACTIONS).map(key => {
258 259
                 const onShortcutSendReaction = () => {
259 260
                     dispatch(addReactionToBuffer(key));
@@ -299,13 +300,14 @@ export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {
299 300
             [ 'A', 'C', 'D', 'P', 'R', 'S', 'W', 'T', 'G' ].forEach(letter =>
300 301
                 dispatch(unregisterShortcut(letter)));
301 302
 
302
-            if (reactionsEnabled) {
303
+            if (_shouldDisplayReactionsButtons) {
303 304
                 Object.keys(REACTIONS).map(key => REACTIONS[key].shortcutChar)
304 305
                     .forEach(letter =>
305 306
                         dispatch(unregisterShortcut(letter, true)));
306 307
             }
307 308
         };
308 309
     }, [
310
+        _shouldDisplayReactionsButtons,
309 311
         chatOpen,
310 312
         desktopSharingButtonDisabled,
311 313
         desktopSharingEnabled,

+ 1
- 1
resources/prosody-plugins/mod_measure_message_count.lua 查看文件

@@ -158,7 +158,7 @@ module:hook("muc-occupant-left", function(event)
158 158
     local occupant, room = event.occupant, event.room;
159 159
     local session = event.origin;
160 160
 
161
-    if session.jitsi_meet_tenant_mismatch then
161
+    if session and session.jitsi_meet_tenant_mismatch then
162 162
         room.jitsi_meet_tenant_mismatch = true;
163 163
     end
164 164
 end);

正在加载...
取消
保存