Browse Source

feat: Add configuration to disable chat emoticons #9889 (#9899)

master
dimitardelchev93 3 years ago
parent
commit
db473dfef5
No account linked to committer's email address

+ 3
- 0
config.js View File

1017
     // Prevent the filmstrip from autohiding when screen width is under a certain threshold
1017
     // Prevent the filmstrip from autohiding when screen width is under a certain threshold
1018
     // disableFilmstripAutohiding: false,
1018
     // disableFilmstripAutohiding: false,
1019
 
1019
 
1020
+    // Specifies whether the chat emoticons are disabled or not
1021
+    // disableChatSmileys: false,
1022
+
1020
     // Allow all above example options to include a trailing comma and
1023
     // Allow all above example options to include a trailing comma and
1021
     // prevent fear when commenting out the last value.
1024
     // prevent fear when commenting out the last value.
1022
     makeJsonParserHappy: 'even if last key had a trailing comma'
1025
     makeJsonParserHappy: 'even if last key had a trailing comma'

+ 1
- 0
react/features/base/config/configWhitelist.js View File

83
     'disableAGC',
83
     'disableAGC',
84
     'disableAP',
84
     'disableAP',
85
     'disableAudioLevels',
85
     'disableAudioLevels',
86
+    'disableChatSmileys',
86
     'disableDeepLinking',
87
     'disableDeepLinking',
87
     'disabledSounds',
88
     'disabledSounds',
88
     'disableFilmstripAutohiding',
89
     'disableFilmstripAutohiding',

+ 46
- 21
react/features/chat/components/web/ChatInput.js View File

8
 import { translate } from '../../../base/i18n';
8
 import { translate } from '../../../base/i18n';
9
 import { Icon, IconPlane, IconSmile } from '../../../base/icons';
9
 import { Icon, IconPlane, IconSmile } from '../../../base/icons';
10
 import { connect } from '../../../base/redux';
10
 import { connect } from '../../../base/redux';
11
+import { areSmileysDisabled } from '../../functions';
11
 
12
 
12
 import SmileysPanel from './SmileysPanel';
13
 import SmileysPanel from './SmileysPanel';
13
 
14
 
35
     /**
36
     /**
36
      * Invoked to obtain translated strings.
37
      * Invoked to obtain translated strings.
37
      */
38
      */
38
-    t: Function
39
+    t: Function,
40
+
41
+    /**
42
+     * Whether chat emoticons are disabled.
43
+     */
44
+    _areSmileysDisabled: boolean
45
+
39
 };
46
 };
40
 
47
 
41
 /**
48
 /**
115
         return (
122
         return (
116
             <div className = { `chat-input-container${this.state.message.trim().length ? ' populated' : ''}` }>
123
             <div className = { `chat-input-container${this.state.message.trim().length ? ' populated' : ''}` }>
117
                 <div id = 'chat-input' >
124
                 <div id = 'chat-input' >
118
-                    <div className = 'smiley-input'>
119
-                        <div id = 'smileysarea'>
120
-                            <div id = 'smileys'>
121
-                                <div
122
-                                    aria-expanded = { this.state.showSmileysPanel }
123
-                                    aria-haspopup = 'smileysContainer'
124
-                                    aria-label = { this.props.t('chat.smileysPanel') }
125
-                                    className = 'smiley-button'
126
-                                    onClick = { this._onToggleSmileysPanel }
127
-                                    onKeyDown = { this._onEscHandler }
128
-                                    onKeyPress = { this._onToggleSmileysPanelKeyPress }
129
-                                    role = 'button'
130
-                                    tabIndex = { 0 }>
131
-                                    <Icon src = { IconSmile } />
125
+                    { this.props._areSmileysDisabled ? null : (
126
+                        <div className = 'smiley-input'>
127
+                            <div id = 'smileysarea'>
128
+                                <div id = 'smileys'>
129
+                                    <div
130
+                                        aria-expanded = { this.state.showSmileysPanel }
131
+                                        aria-haspopup = 'smileysContainer'
132
+                                        aria-label = { this.props.t('chat.smileysPanel') }
133
+                                        className = 'smiley-button'
134
+                                        onClick = { this._onToggleSmileysPanel }
135
+                                        onKeyDown = { this._onEscHandler }
136
+                                        onKeyPress = { this._onToggleSmileysPanelKeyPress }
137
+                                        role = 'button'
138
+                                        tabIndex = { 0 }>
139
+                                        <Icon src = { IconSmile } />
140
+                                    </div>
132
                                 </div>
141
                                 </div>
133
                             </div>
142
                             </div>
143
+                            <div
144
+                                className = { smileysPanelClassName } >
145
+                                <SmileysPanel
146
+                                    onSmileySelect = { this._onSmileySelect } />
147
+                            </div>
134
                         </div>
148
                         </div>
135
-                        <div className = { smileysPanelClassName }>
136
-                            <SmileysPanel
137
-                                onSmileySelect = { this._onSmileySelect } />
138
-                        </div>
139
-                    </div>
149
+                    ) }
140
                     <div className = 'usrmsg-form'>
150
                     <div className = 'usrmsg-form'>
141
                         <TextareaAutosize
151
                         <TextareaAutosize
142
                             autoComplete = 'off'
152
                             autoComplete = 'off'
336
     }
346
     }
337
 }
347
 }
338
 
348
 
339
-export default translate(connect()(ChatInput));
349
+/**
350
+ * Function that maps parts of Redux state tree into component props.
351
+ *
352
+ * @param {Object} state - Redux state.
353
+ * @private
354
+ * @returns {{
355
+ *     _areSmileysDisabled: boolean
356
+ * }}
357
+ */
358
+const mapStateToProps = state => {
359
+    return {
360
+        _areSmileysDisabled: areSmileysDisabled(state)
361
+    };
362
+};
363
+
364
+export default translate(connect(mapStateToProps)(ChatInput));

+ 12
- 0
react/features/chat/functions.js View File

90
 
90
 
91
     return nbUnreadMessages;
91
     return nbUnreadMessages;
92
 }
92
 }
93
+
94
+/**
95
+ * Get whether the chat smileys are disabled or not.
96
+ *
97
+ * @param {Object} state - The redux state.
98
+ * @returns {boolean} The disabled flag.
99
+ */
100
+export function areSmileysDisabled(state: Object) {
101
+    const disableChatSmileys = state['features/base/config']?.disableChatSmileys === true;
102
+
103
+    return disableChatSmileys;
104
+}

Loading…
Cancel
Save