Przeglądaj źródła

Comply w/ coding style

@virtuacoplenny, the changes of this commit are not necessarily in
source code that you introduced in
https://github.com/jitsi/jitsi-meet/pull/1499 but I saw violations in
files modified in the PR which I had to read in order to understand the
PR.
master
Lyubo Marinov 8 lat temu
rodzic
commit
55c3f5ddff

+ 6
- 9
conference.js Wyświetl plik

409
             break;
409
             break;
410
 
410
 
411
             // not enough rights to create conference
411
             // not enough rights to create conference
412
-        case ConferenceErrors.AUTHENTICATION_REQUIRED:
413
-            {
414
-                // schedule reconnect to check if someone else created the room
415
-                this.reconnectTimeout = setTimeout(function () {
416
-                    room.join();
417
-                }, 5000);
412
+        case ConferenceErrors.AUTHENTICATION_REQUIRED: {
413
+                // Schedule reconnect to check if someone else created the room.
414
+                this.reconnectTimeout = setTimeout(() => room.join(), 5000);
418
 
415
 
419
                 const { password }
416
                 const { password }
420
                     = APP.store.getState()['features/base/conference'];
417
                     = APP.store.getState()['features/base/conference'];
1449
             APP.UI.changeDisplayName(id, formattedDisplayName);
1446
             APP.UI.changeDisplayName(id, formattedDisplayName);
1450
         });
1447
         });
1451
 
1448
 
1452
-        room.on(ConferenceEvents.LOCK_STATE_CHANGED, (...args) => {
1453
-            APP.store.dispatch(lockStateChanged(room, ...args));
1454
-        });
1449
+        room.on(
1450
+            ConferenceEvents.LOCK_STATE_CHANGED,
1451
+            (...args) => APP.store.dispatch(lockStateChanged(room, ...args)));
1455
 
1452
 
1456
         room.on(ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
1453
         room.on(ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
1457
                 (participant, name, oldValue, newValue) => {
1454
                 (participant, name, oldValue, newValue) => {

+ 6
- 6
css/modals/invite/_invite.scss Wyświetl plik

24
             margin-top: 10px;
24
             margin-top: 10px;
25
         }
25
         }
26
 
26
 
27
-        .password-overview-toggle-edit,
28
-        .remove-password-link {
29
-            cursor: pointer;
30
-            text-decoration: none;
31
-        }
32
-
33
         .password-overview-status,
27
         .password-overview-status,
34
         .remove-password {
28
         .remove-password {
35
             display: flex;
29
             display: flex;
36
             justify-content: space-between;
30
             justify-content: space-between;
37
         }
31
         }
38
 
32
 
33
+        .password-overview-toggle-edit,
34
+        .remove-password-link {
35
+            cursor: pointer;
36
+            text-decoration: none;
37
+        }
38
+
39
         .remove-password {
39
         .remove-password {
40
             margin-top: 15px;
40
             margin-top: 15px;
41
         }
41
         }

+ 4
- 6
modules/UI/side_pannels/contactlist/ContactList.js Wyświetl plik

24
      * @returns {Boolean}
24
      * @returns {Boolean}
25
      */
25
      */
26
     isLocked() {
26
     isLocked() {
27
-        const conference = APP.store.getState()['features/base/conference'];
28
-
29
-        return conference.locked;
27
+        return APP.store.getState()['features/base/conference'].locked;
30
     }
28
     }
31
 
29
 
32
     /**
30
     /**
36
      * @param isLocal
34
      * @param isLocal
37
      */
35
      */
38
     addContact(id, isLocal) {
36
     addContact(id, isLocal) {
39
-        let isExist = this.contacts.some((el) => el.id === id);
37
+        const exists = this.contacts.some(el => el.id === id);
40
 
38
 
41
-        if (!isExist) {
39
+        if (!exists) {
42
             let newContact = new Contact({ id, isLocal });
40
             let newContact = new Contact({ id, isLocal });
43
             this.contacts.push(newContact);
41
             this.contacts.push(newContact);
44
             APP.UI.emitEvent(UIEvents.CONTACT_ADDED, { id, isLocal });
42
             APP.UI.emitEvent(UIEvents.CONTACT_ADDED, { id, isLocal });
92
     }
90
     }
93
 }
91
 }
94
 
92
 
95
-export default ContactList;
93
+export default ContactList;

+ 20
- 11
modules/UI/side_pannels/contactlist/ContactListView.js Wyświetl plik

1
 /* global $, APP, interfaceConfig */
1
 /* global $, APP, interfaceConfig */
2
-const logger = require("jitsi-meet-logger").getLogger(__filename);
3
 
2
 
4
 import { openInviteDialog } from '../../../../react/features/invite';
3
 import { openInviteDialog } from '../../../../react/features/invite';
5
 
4
 
7
 import UIEvents from '../../../../service/UI/UIEvents';
6
 import UIEvents from '../../../../service/UI/UIEvents';
8
 import UIUtil from '../../util/UIUtil';
7
 import UIUtil from '../../util/UIUtil';
9
 
8
 
9
+const logger = require('jitsi-meet-logger').getLogger(__filename);
10
+
10
 let numberOfContacts = 0;
11
 let numberOfContacts = 0;
11
 const sidePanelsContainerId = 'sideToolbarContainer';
12
 const sidePanelsContainerId = 'sideToolbarContainer';
12
 const htmlStr = `
13
 const htmlStr = `
169
         APP.UI.addListener(UIEvents.USER_AVATAR_CHANGED, changeAvatar);
170
         APP.UI.addListener(UIEvents.USER_AVATAR_CHANGED, changeAvatar);
170
         APP.UI.addListener(UIEvents.DISPLAY_NAME_CHANGED, displayNameChange);
171
         APP.UI.addListener(UIEvents.DISPLAY_NAME_CHANGED, displayNameChange);
171
     },
172
     },
173
+
172
     /**
174
     /**
173
      * Updates the view according to the passed in lock state.
175
      * Updates the view according to the passed in lock state.
174
      *
176
      *
175
-     * @param {boolean} isLocked - True if the locked UI state should display.
177
+     * @param {boolean} locked - True to display the locked UI state or false to
178
+     * display the unlocked UI state.
176
      */
179
      */
177
-    setLockDisplay(isLocked) {
178
-        const showKey = isLocked ? this.lockKey : this.unlockKey;
179
-        const hideKey = !isLocked ? this.lockKey : this.unlockKey;
180
-        const showId = `contactList${showKey}`;
181
-        const hideId = `contactList${hideKey}`;
182
-
183
-        $(`#${showId}`).show();
184
-        $(`#${hideId}`).hide();
180
+    setLockDisplay(locked) {
181
+        let hideKey, showKey;
182
+
183
+        if (locked) {
184
+            hideKey = this.unlockKey;
185
+            showKey = this.lockKey;
186
+        } else {
187
+            hideKey = this.lockKey;
188
+            showKey = this.unlockKey;
189
+        }
190
+
191
+        $(`#contactList${hideKey}`).hide();
192
+        $(`#contactList${showKey}`).show();
185
     },
193
     },
194
+
186
     /**
195
     /**
187
      * Indicates if the chat is currently visible.
196
      * Indicates if the chat is currently visible.
188
      *
197
      *
277
     }
286
     }
278
 };
287
 };
279
 
288
 
280
-export default ContactListView;
289
+export default ContactListView;

+ 1
- 1
react/features/base/conference/actionTypes.js Wyświetl plik

118
 
118
 
119
 /**
119
 /**
120
  * The type of Redux action which signals that setting a password on a
120
  * The type of Redux action which signals that setting a password on a
121
- * JitsiConference encountered an error and failed.
121
+ * JitsiConference failed (with an error).
122
  *
122
  *
123
  * {
123
  * {
124
  *     type: SET_PASSWORD_FAILED,
124
  *     type: SET_PASSWORD_FAILED,

+ 14
- 8
react/features/base/conference/reducer.js Wyświetl plik

85
             audioOnlyVideoMuted: undefined,
85
             audioOnlyVideoMuted: undefined,
86
             conference: undefined,
86
             conference: undefined,
87
             leaving: undefined,
87
             leaving: undefined,
88
+
89
+            /**
90
+             * The indicator of how the conference/room is locked. If falsy, the
91
+             * conference/room is unlocked; otherwise, it's either
92
+             * {@code LOCKED_LOCALLY| or {@code LOCKED_REMOTELY}.
93
+             *
94
+             * @type {string}
95
+             */
88
             locked: passwordRequired ? LOCKED_REMOTELY : undefined,
96
             locked: passwordRequired ? LOCKED_REMOTELY : undefined,
89
             password: undefined,
97
             password: undefined,
90
 
98
 
211
         return state;
219
         return state;
212
     }
220
     }
213
 
221
 
214
-    let lockState;
222
+    let locked;
215
 
223
 
216
     if (action.locked) {
224
     if (action.locked) {
217
-        lockState = state.locked || LOCKED_REMOTELY;
225
+        locked = state.locked || LOCKED_REMOTELY;
218
     }
226
     }
219
 
227
 
220
     return setStateProperties(state, {
228
     return setStateProperties(state, {
221
-        locked: lockState,
229
+        locked,
222
         password: action.locked ? state.password : null
230
         password: action.locked ? state.password : null
223
     });
231
     });
224
 }
232
 }
265
     const conference = action.conference;
273
     const conference = action.conference;
266
 
274
 
267
     switch (action.method) {
275
     switch (action.method) {
268
-    case conference.join: {
276
+    case conference.join:
269
         if (state.passwordRequired === conference) {
277
         if (state.passwordRequired === conference) {
270
             return (
278
             return (
271
                 setStateProperties(state, {
279
                 setStateProperties(state, {
280
                     passwordRequired: undefined
288
                     passwordRequired: undefined
281
                 }));
289
                 }));
282
         }
290
         }
283
-
284
         break;
291
         break;
285
-    }
286
-    case conference.lock: {
292
+
293
+    case conference.lock:
287
         return setStateProperties(state, {
294
         return setStateProperties(state, {
288
             locked: action.password ? LOCKED_LOCALLY : undefined,
295
             locked: action.password ? LOCKED_LOCALLY : undefined,
289
             password: action.password
296
             password: action.password
290
         });
297
         });
291
     }
298
     }
292
-    }
293
 
299
 
294
     return state;
300
     return state;
295
 }
301
 }

+ 3
- 5
react/features/invite/actions.js Wyświetl plik

10
  * @returns {Function}
10
  * @returns {Function}
11
  */
11
  */
12
 export function openInviteDialog() {
12
 export function openInviteDialog() {
13
-    return dispatch => {
14
-        dispatch(openDialog(InviteDialog, {
15
-            conferenceUrl: encodeURI(APP.ConferenceUrl.getInviteUrl())
16
-        }));
17
-    };
13
+    return openDialog(InviteDialog, {
14
+        conferenceUrl: encodeURI(APP.ConferenceUrl.getInviteUrl())
15
+    });
18
 }
16
 }

+ 16
- 7
react/features/invite/components/AddPasswordForm.js Wyświetl plik

5
 import { translate } from '../../base/i18n';
5
 import { translate } from '../../base/i18n';
6
 
6
 
7
 /**
7
 /**
8
- * A React Component for locking a JitsiConference with a password.
8
+ * A React {@code Component} for locking a JitsiConference with a password.
9
  */
9
  */
10
 class AddPasswordForm extends Component {
10
 class AddPasswordForm extends Component {
11
     /**
11
     /**
12
-     * AddPasswordForm component's property types.
12
+     * {@code AddPasswordForm}'s property types.
13
      *
13
      *
14
      * @static
14
      * @static
15
      */
15
      */
33
     }
33
     }
34
 
34
 
35
     /**
35
     /**
36
-     * Initializes a new AddPasswordForm instance.
36
+     * Initializes a new {@code AddPasswordForm} instance.
37
      *
37
      *
38
      * @param {Object} props - The read-only properties with which the new
38
      * @param {Object} props - The read-only properties with which the new
39
      * instance is to be initialized.
39
      * instance is to be initialized.
42
         super(props);
42
         super(props);
43
 
43
 
44
         this.state = {
44
         this.state = {
45
+            /**
46
+             * The current value to display in {@code AddPasswordForm}
47
+             * component's input field. The value is also used as the desired
48
+             * new password when creating a {@code setPassword} action.
49
+             *
50
+             * @type {string}
51
+             */
45
             password: ''
52
             password: ''
46
         };
53
         };
47
 
54
 
55
+        // Bind event handlers so they are only bound once for every instance.
48
         this._onKeyDown = this._onKeyDown.bind(this);
56
         this._onKeyDown = this._onKeyDown.bind(this);
49
         this._onPasswordChange = this._onPasswordChange.bind(this);
57
         this._onPasswordChange = this._onPasswordChange.bind(this);
50
         this._onSubmit = this._onSubmit.bind(this);
58
         this._onSubmit = this._onSubmit.bind(this);
57
      * @returns {ReactElement}
65
      * @returns {ReactElement}
58
      */
66
      */
59
     render() {
67
     render() {
68
+        const { t } = this.props;
69
+
60
         return (
70
         return (
61
             <div
71
             <div
62
                 className = 'form-control'
72
                 className = 'form-control'
68
                         id = 'newPasswordInput'
78
                         id = 'newPasswordInput'
69
                         onChange = { this._onPasswordChange }
79
                         onChange = { this._onPasswordChange }
70
                         onKeyDown = { this._onKeyDown }
80
                         onKeyDown = { this._onKeyDown }
71
-                        placeholder
72
-                            = { this.props.t('dialog.createPassword') }
81
+                        placeholder = { t('dialog.createPassword') }
73
                         type = 'text' />
82
                         type = 'text' />
74
                     <button
83
                     <button
75
                         className = 'button-control button-control_light'
84
                         className = 'button-control button-control_light'
77
                         id = 'addPasswordBtn'
86
                         id = 'addPasswordBtn'
78
                         onClick = { this._onSubmit }
87
                         onClick = { this._onSubmit }
79
                         type = 'button'>
88
                         type = 'button'>
80
-                        { this.props.t('dialog.add') }
89
+                        { t('dialog.add') }
81
                     </button>
90
                     </button>
82
                 </div>
91
                 </div>
83
             </div>
92
             </div>
122
             return;
131
             return;
123
         }
132
         }
124
 
133
 
125
-        const conference = this.props.conference;
134
+        const { conference } = this.props;
126
 
135
 
127
         this.props.dispatch(setPassword(
136
         this.props.dispatch(setPassword(
128
             conference,
137
             conference,

+ 16
- 10
react/features/invite/components/InviteDialog.js Wyświetl plik

13
 import ShareLinkForm from './ShareLinkForm';
13
 import ShareLinkForm from './ShareLinkForm';
14
 
14
 
15
 /**
15
 /**
16
- * A React Component for displaying other components responsible for copying the
17
- * current conference url and for setting or removing a conference password.
16
+ * A React {@code Component} for displaying other components responsible for
17
+ * copying the current conference url and for setting or removing a conference
18
+ * password.
18
  */
19
  */
19
 class InviteDialog extends Component {
20
 class InviteDialog extends Component {
20
     /**
21
     /**
21
-     * InviteDialog component's property types.
22
+     * {@code InviteDialog} component's property types.
22
      *
23
      *
23
      * @static
24
      * @static
24
      */
25
      */
61
      * @returns {ReactElement}
62
      * @returns {ReactElement}
62
      */
63
      */
63
     render() {
64
     render() {
65
+        const { _conference } = this.props;
66
+        const titleString
67
+            = this.props.t(
68
+                'invite.inviteTo',
69
+                { conferenceName: _conference.room });
70
+
64
         return (
71
         return (
65
             <Dialog
72
             <Dialog
66
                 cancelDisabled = { true }
73
                 cancelDisabled = { true }
67
                 okTitleKey = 'dialog.done'
74
                 okTitleKey = 'dialog.done'
68
-                titleString = { this.props.t(
69
-                    'invite.inviteTo',
70
-                    { conferenceName: this.props._conference.room }) } >
75
+                titleString = { titleString }>
71
                 <div className = 'invite-dialog'>
76
                 <div className = 'invite-dialog'>
72
                     <ShareLinkForm toCopy = { this.props.conferenceUrl } />
77
                     <ShareLinkForm toCopy = { this.props.conferenceUrl } />
73
                     <PasswordContainer
78
                     <PasswordContainer
74
-                        conference = { this.props._conference.conference }
75
-                        locked = { this.props._conference.locked }
76
-                        password = { this.props._conference.password }
79
+                        conference = { _conference.conference }
80
+                        locked = { _conference.locked }
81
+                        password = { _conference.password }
77
                         showPasswordEdit = { this.props._isModerator } />
82
                         showPasswordEdit = { this.props._isModerator } />
78
                 </div>
83
                 </div>
79
             </Dialog>
84
             </Dialog>
82
 }
87
 }
83
 
88
 
84
 /**
89
 /**
85
- * Maps (parts of) the Redux state to the associated InviteDialog's props.
90
+ * Maps (parts of) the Redux state to the associated {@code InviteDialog}'s
91
+ * props.
86
  *
92
  *
87
  * @param {Object} state - The Redux state.
93
  * @param {Object} state - The Redux state.
88
  * @private
94
  * @private

+ 17
- 7
react/features/invite/components/LockStatePanel.js Wyświetl plik

7
  */
7
  */
8
 class LockStatePanel extends Component {
8
 class LockStatePanel extends Component {
9
     /**
9
     /**
10
-     * LockStatePanel component's property types.
10
+     * {@code LockStatePanel}'s property types.
11
      *
11
      *
12
      * @static
12
      * @static
13
      */
13
      */
30
      * @returns {ReactElement}
30
      * @returns {ReactElement}
31
      */
31
      */
32
     render() {
32
     render() {
33
-        const [ lockStateClass, lockIconClass, lockTextKey ] = this.props.locked
34
-            ? [ 'is-locked', 'icon-security-locked', 'invite.locked' ]
35
-            : [ 'is-unlocked', 'icon-security', 'invite.unlocked' ];
33
+        let iconClass;
34
+        let stateClass;
35
+        let textKey;
36
+
37
+        if (this.props.locked) {
38
+            iconClass = 'icon-security-locked';
39
+            stateClass = 'is-locked';
40
+            textKey = 'invite.locked';
41
+        } else {
42
+            iconClass = 'icon-security';
43
+            stateClass = 'is-unlocked';
44
+            textKey = 'invite.unlocked';
45
+        }
36
 
46
 
37
         return (
47
         return (
38
-            <div className = { `lock-state ${lockStateClass}` }>
39
-                <span className = { lockIconClass } />
48
+            <div className = { `lock-state ${stateClass}` }>
49
+                <span className = { iconClass } />
40
                 <span>
50
                 <span>
41
-                    { this.props.t(lockTextKey) }
51
+                    { this.props.t(textKey) }
42
                 </span>
52
                 </span>
43
             </div>
53
             </div>
44
         );
54
         );

+ 18
- 9
react/features/invite/components/PasswordContainer.js Wyświetl plik

8
 import RemovePasswordForm from './RemovePasswordForm';
8
 import RemovePasswordForm from './RemovePasswordForm';
9
 
9
 
10
 /**
10
 /**
11
- * React component for displaying the current room lock state as well as
11
+ * React {@code Component} for displaying the current room lock state as well as
12
  * exposing features to modify the room lock.
12
  * exposing features to modify the room lock.
13
  */
13
  */
14
 class PasswordContainer extends Component {
14
 class PasswordContainer extends Component {
15
     /**
15
     /**
16
-     * PasswordContainer component's property types.
16
+     * {@code PasswordContainer}'s property types.
17
      *
17
      *
18
      * @static
18
      * @static
19
      */
19
      */
49
     }
49
     }
50
 
50
 
51
     /**
51
     /**
52
-     * Initializes a new PasswordContainer instance.
52
+     * Initializes a new {@code PasswordContainer} instance.
53
      *
53
      *
54
      * @param {Object} props - The read-only properties with which the new
54
      * @param {Object} props - The read-only properties with which the new
55
      * instance is to be initialized.
55
      * instance is to be initialized.
58
         super(props);
58
         super(props);
59
 
59
 
60
         this.state = {
60
         this.state = {
61
+            /**
62
+             * Whether or not the form to edit the password should display. If
63
+             * true, the form should display.
64
+             *
65
+             * @type {boolean}
66
+             */
61
             isEditingPassword: false
67
             isEditingPassword: false
62
         };
68
         };
63
 
69
 
70
+        // Bind event handlers so they are only bound once for every instance.
64
         this._onTogglePasswordEdit = this._onTogglePasswordEdit.bind(this);
71
         this._onTogglePasswordEdit = this._onTogglePasswordEdit.bind(this);
65
     }
72
     }
66
 
73
 
105
             return null;
112
             return null;
106
         }
113
         }
107
 
114
 
108
-        return this.props.locked
109
-            ? <RemovePasswordForm
110
-                conference = { this.props.conference }
111
-                lockedLocally = { this.props.locked === LOCKED_LOCALLY }
112
-                password = { this.props.password } />
113
-            : <AddPasswordForm conference = { this.props.conference } />;
115
+        return (
116
+            this.props.locked
117
+                ? <RemovePasswordForm
118
+                    conference = { this.props.conference }
119
+                    lockedLocally = { this.props.locked === LOCKED_LOCALLY }
120
+                    password = { this.props.password } />
121
+                : <AddPasswordForm conference = { this.props.conference } />
122
+        );
114
     }
123
     }
115
 
124
 
116
     /**
125
     /**

+ 9
- 8
react/features/invite/components/RemovePasswordForm.js Wyświetl plik

5
 import { translate } from '../../base/i18n';
5
 import { translate } from '../../base/i18n';
6
 
6
 
7
 /**
7
 /**
8
- * A React Component for removing a lock from a JitsiConference.
8
+ * A React {@code Component} for removing a lock from a JitsiConference.
9
  */
9
  */
10
 class RemovePasswordForm extends Component {
10
 class RemovePasswordForm extends Component {
11
     /**
11
     /**
12
-     * RemovePasswordForm component's property types.
12
+     * {@code RemovePasswordForm}'s property types.
13
      *
13
      *
14
      * @static
14
      * @static
15
      */
15
      */
43
     }
43
     }
44
 
44
 
45
     /**
45
     /**
46
-     * Initializes a new RemovePasswordForm instance.
46
+     * Initializes a new {@code RemovePasswordForm} instance.
47
      *
47
      *
48
      * @param {Object} props - The read-only properties with which the new
48
      * @param {Object} props - The read-only properties with which the new
49
      * instance is to be initialized.
49
      * instance is to be initialized.
51
     constructor(props) {
51
     constructor(props) {
52
         super(props);
52
         super(props);
53
 
53
 
54
+        // Bind event handlers so they are only bound once for every instance.
54
         this._onClick = this._onClick.bind(this);
55
         this._onClick = this._onClick.bind(this);
55
     }
56
     }
56
 
57
 
83
      * @returns {ReactElement}
84
      * @returns {ReactElement}
84
      */
85
      */
85
     _getPasswordPreviewText() {
86
     _getPasswordPreviewText() {
87
+        const { lockedLocally, password, t } = this.props;
88
+
86
         return (
89
         return (
87
             <span>
90
             <span>
88
                 <span>
91
                 <span>
89
-                    { `${this.props.t('dialog.currentPassword')} ` }
92
+                    { `${t('dialog.currentPassword')} ` }
90
                 </span>
93
                 </span>
91
                 <span className = 'remove-password-current'>
94
                 <span className = 'remove-password-current'>
92
-                    { this.props.lockedLocally
93
-                        ? this.props.password
94
-                        : this.props.t('passwordSetRemotely') }
95
+                    { lockedLocally ? password : t('passwordSetRemotely') }
95
                 </span>
96
                 </span>
96
             </span>
97
             </span>
97
         );
98
         );
104
      * @returns {void}
105
      * @returns {void}
105
      */
106
      */
106
     _onClick() {
107
     _onClick() {
107
-        const conference = this.props.conference;
108
+        const { conference } = this.props;
108
 
109
 
109
         this.props.dispatch(setPassword(
110
         this.props.dispatch(setPassword(
110
             conference,
111
             conference,

+ 25
- 15
react/features/invite/components/ShareLinkForm.js Wyświetl plik

5
 const logger = require('jitsi-meet-logger').getLogger(__filename);
5
 const logger = require('jitsi-meet-logger').getLogger(__filename);
6
 
6
 
7
 /**
7
 /**
8
- * A React Component for displaying a value with a copy button that can be
9
- * clicked to copy the value onto the clipboard.
8
+ * A React {@code Component} for displaying a value with a copy button to copy
9
+ * the value into the clipboard.
10
  */
10
  */
11
 class ShareLinkForm extends Component {
11
 class ShareLinkForm extends Component {
12
     /**
12
     /**
13
-     * ShareLinkForm component's property types.
13
+     * {@code ShareLinkForm}'s property types.
14
      *
14
      *
15
      * @static
15
      * @static
16
      */
16
      */
20
          */
20
          */
21
         t: React.PropTypes.func,
21
         t: React.PropTypes.func,
22
 
22
 
23
-       /**
24
-         * The value to be displayed and copied onto the clipboard.
23
+        /**
24
+         * The value to be displayed and copied into the clipboard.
25
          */
25
          */
26
         toCopy: React.PropTypes.string
26
         toCopy: React.PropTypes.string
27
     }
27
     }
28
 
28
 
29
     /**
29
     /**
30
-     * Initializes a new ShareLinkForm instance.
30
+     * Initializes a new {@code ShareLinkForm} instance.
31
      *
31
      *
32
      * @param {Object} props - The read-only properties with which the new
32
      * @param {Object} props - The read-only properties with which the new
33
      * instance is to be initialized.
33
      * instance is to be initialized.
35
     constructor(props) {
35
     constructor(props) {
36
         super(props);
36
         super(props);
37
 
37
 
38
+        /**
39
+         * The internal reference to the DOM/HTML element backing the React
40
+         * {@code Component} input with id {@code inviteLinkRef}. It is
41
+         * necessary for the implementation of copying to the clipboard.
42
+         *
43
+         * @private
44
+         * @type {HTMLInputElement}
45
+         */
38
         this._inputElement = null;
46
         this._inputElement = null;
39
 
47
 
48
+        // Bind event handlers so they are only bound once for every instance.
40
         this._onClick = this._onClick.bind(this);
49
         this._onClick = this._onClick.bind(this);
41
         this._setInput = this._setInput.bind(this);
50
         this._setInput = this._setInput.bind(this);
42
     }
51
     }
48
      * @returns {ReactElement}
57
      * @returns {ReactElement}
49
      */
58
      */
50
     render() {
59
     render() {
51
-        const inputValue = this.props.toCopy
52
-            || this.props.t('inviteUrlDefaultMsg');
60
+        const { t } = this.props;
61
+        const inputValue = this.props.toCopy || t('inviteUrlDefaultMsg');
53
 
62
 
54
-        // FIXME input is used here instead of atlaskit field-text because
55
-        // field-text does not currently support readonly
63
+        // FIXME An input HTML element is used here instead of atlaskit's
64
+        // field-text because the latter does not currently support readOnly.
56
         return (
65
         return (
57
             <div className = 'form-control'>
66
             <div className = 'form-control'>
58
                 <label className = 'form-control__label'>
67
                 <label className = 'form-control__label'>
59
-                    { this.props.t('dialog.shareLink') }
68
+                    { t('dialog.shareLink') }
60
                 </label>
69
                 </label>
61
                 <div className = 'form-control__container'>
70
                 <div className = 'form-control__container'>
62
                     <input
71
                     <input
71
                             'button-control button-control_light copyInviteLink'
80
                             'button-control button-control_light copyInviteLink'
72
                         onClick = { this._onClick }
81
                         onClick = { this._onClick }
73
                         type = 'button'>
82
                         type = 'button'>
74
-                        { this.props.t('dialog.copy') }
83
+                        { t('dialog.copy') }
75
                     </button>
84
                     </button>
76
                 </div>
85
                 </div>
77
             </div>
86
             </div>
95
     }
104
     }
96
 
105
 
97
     /**
106
     /**
98
-     * Sets the internal reference to the DOM element for the input field so it
99
-     * may be accessed directly.
107
+     * Sets the internal reference to the DOM/HTML element backing the React
108
+     * {@code Component} input with id {@code inviteLinkRef}.
100
      *
109
      *
101
-     * @param {Object} element - DOM element for the component's input.
110
+     * @param {HTMLInputElement} element - The DOM/HTML element for this
111
+     * {@code Component}'s input.
102
      * @private
112
      * @private
103
      * @returns {void}
113
      * @returns {void}
104
      */
114
      */

+ 26
- 21
react/features/room-lock/components/PasswordRequiredPrompt.web.js Wyświetl plik

1
 /* global APP */
1
 /* global APP */
2
+
3
+import AKFieldText from '@atlaskit/field-text';
2
 import React, { Component } from 'react';
4
 import React, { Component } from 'react';
3
 import { connect } from 'react-redux';
5
 import { connect } from 'react-redux';
4
-import AKFieldText from '@atlaskit/field-text';
5
 
6
 
6
 import UIEvents from '../../../../service/UI/UIEvents';
7
 import UIEvents from '../../../../service/UI/UIEvents';
7
 
8
 
39
     constructor(props) {
40
     constructor(props) {
40
         super(props);
41
         super(props);
41
 
42
 
42
-        this.state = { password: '' };
43
+        this.state = {
44
+            password: ''
45
+        };
43
 
46
 
44
         this._onPasswordChanged = this._onPasswordChanged.bind(this);
47
         this._onPasswordChanged = this._onPasswordChanged.bind(this);
45
         this._onSubmit = this._onSubmit.bind(this);
48
         this._onSubmit = this._onSubmit.bind(this);
69
      * @protected
72
      * @protected
70
      */
73
      */
71
     _renderBody() {
74
     _renderBody() {
72
-        const { t } = this.props;
73
-
74
         return (
75
         return (
75
             <div>
76
             <div>
76
                 <AKFieldText
77
                 <AKFieldText
77
                     compact = { true }
78
                     compact = { true }
78
-                    label = { t('dialog.passwordLabel') }
79
+                    label = { this.props.t('dialog.passwordLabel') }
79
                     name = 'lockKey'
80
                     name = 'lockKey'
80
                     onChange = { this._onPasswordChanged }
81
                     onChange = { this._onPasswordChanged }
81
                     shouldFitContainer = { true }
82
                     shouldFitContainer = { true }
82
                     type = 'text'
83
                     type = 'text'
83
                     value = { this.state.password } />
84
                     value = { this.state.password } />
84
-            </div>);
85
+            </div>
86
+        );
85
     }
87
     }
86
 
88
 
87
     /**
89
     /**
92
      * @returns {void}
94
      * @returns {void}
93
      */
95
      */
94
     _onPasswordChanged(event) {
96
     _onPasswordChanged(event) {
95
-        this.setState({ password: event.target.value });
97
+        this.setState({
98
+            password: event.target.value
99
+        });
96
     }
100
     }
97
 
101
 
98
     /**
102
     /**
102
      * @returns {void}
106
      * @returns {void}
103
      */
107
      */
104
     _onSubmit() {
108
     _onSubmit() {
105
-        const conference = this.props.conference;
106
-
107
-        // we received that password is required, but user is trying
108
-        // anyway to login without a password, mark room as not
109
-        // locked in case he succeeds (maybe someone removed the
110
-        // password meanwhile), if it is still locked another
111
-        // password required will be received and the room again
112
-        // will be marked as locked.
109
+        const { conference } = this.props;
110
+
111
+        // We received that password is required, but user is trying anyway to
112
+        // login without a password. Mark the room as not locked in case she
113
+        // succeeds (maybe someone removed the password meanwhile). If it is
114
+        // still locked, another password required will be received and the room
115
+        // again will be marked as locked.
113
         if (!this.state.password || this.state.password === '') {
116
         if (!this.state.password || this.state.password === '') {
114
-            // XXX temporary solution while some components are not listening
115
-            // for lock state updates in redux
117
+            // XXX Temporary solution while some components are not listening
118
+            // for lock state updates in redux.
116
             APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK, false);
119
             APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK, false);
117
         }
120
         }
118
 
121
 
119
-        this.props.dispatch(setPassword(
120
-            conference, conference.join, this.state.password));
122
+        this.props.dispatch(
123
+            setPassword(conference, conference.join, this.state.password));
121
 
124
 
122
-        // we have used the password lets clean it
123
-        this.setState({ password: undefined });
125
+        // We have used the password so let's clean it.
126
+        this.setState({
127
+            password: undefined
128
+        });
124
 
129
 
125
         return true;
130
         return true;
126
     }
131
     }

+ 5
- 2
react/features/room-lock/constants.js Wyświetl plik

1
 /**
1
 /**
2
- * The room lock state where the password was set by the current user.
2
+ * The conference/room lock state which identifies that the password was set by
3
+ * the current/local participant/user.
3
  *
4
  *
4
  * @type {string}
5
  * @type {string}
5
  */
6
  */
6
 export const LOCKED_LOCALLY = 'LOCKED_LOCALLY';
7
 export const LOCKED_LOCALLY = 'LOCKED_LOCALLY';
7
 
8
 
8
 /**
9
 /**
9
- * The room lock state where the password was set by a remote user.
10
+ * The conference/room lock state which identifies that the password was set by
11
+ * a remote participant/user.
12
+ *
10
  * @type {string}
13
  * @type {string}
11
  */
14
  */
12
 export const LOCKED_REMOTELY = 'LOCKED_REMOTELY';
15
 export const LOCKED_REMOTELY = 'LOCKED_REMOTELY';

+ 27
- 24
react/features/room-lock/middleware.js Wyświetl plik

1
 /* global APP */
1
 /* global APP */
2
-const logger = require('jitsi-meet-logger').getLogger(__filename);
3
 
2
 
4
 import UIEvents from '../../../service/UI/UIEvents';
3
 import UIEvents from '../../../service/UI/UIEvents';
5
 
4
 
8
     LOCK_STATE_CHANGED,
7
     LOCK_STATE_CHANGED,
9
     SET_PASSWORD_FAILED
8
     SET_PASSWORD_FAILED
10
 } from '../base/conference';
9
 } from '../base/conference';
11
-import JitsiMeetJS from '../base/lib-jitsi-meet';
10
+import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
12
 import { MiddlewareRegistry } from '../base/redux';
11
 import { MiddlewareRegistry } from '../base/redux';
13
 
12
 
14
 import { _showPasswordDialog } from './actions';
13
 import { _showPasswordDialog } from './actions';
15
 
14
 
15
+const logger = require('jitsi-meet-logger').getLogger(__filename);
16
+
16
 /**
17
 /**
17
  * Middleware that captures conference failed and checks for password required
18
  * Middleware that captures conference failed and checks for password required
18
  * error and requests a dialog for user to enter password.
19
  * error and requests a dialog for user to enter password.
21
  * @returns {Function}
22
  * @returns {Function}
22
  */
23
  */
23
 MiddlewareRegistry.register(store => next => action => {
24
 MiddlewareRegistry.register(store => next => action => {
24
-
25
     switch (action.type) {
25
     switch (action.type) {
26
     case CONFERENCE_FAILED: {
26
     case CONFERENCE_FAILED: {
27
-        const JitsiConferenceErrors = JitsiMeetJS.errors.conference;
27
+        const { conference, error } = action;
28
 
28
 
29
-        if (action.conference
30
-            && JitsiConferenceErrors.PASSWORD_REQUIRED === action.error) {
31
-            // XXX temporary solution while some components are not listening
32
-            // for lock state updates in redux
29
+        if (conference && error === JitsiConferenceErrors.PASSWORD_REQUIRED) {
30
+            // XXX Temporary solution while some components are not listening
31
+            // for lock state updates in redux.
33
             if (typeof APP !== 'undefined') {
32
             if (typeof APP !== 'undefined') {
34
                 APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK, true);
33
                 APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK, true);
35
             }
34
             }
36
 
35
 
37
-            store.dispatch(_showPasswordDialog(action.conference));
36
+            store.dispatch(_showPasswordDialog(conference));
38
         }
37
         }
39
         break;
38
         break;
40
     }
39
     }
41
-    case LOCK_STATE_CHANGED: {
40
+
41
+    case LOCK_STATE_CHANGED:
42
         // TODO Remove this logic when all components interested in the lock
42
         // TODO Remove this logic when all components interested in the lock
43
         // state change event are moved into react/redux.
43
         // state change event are moved into react/redux.
44
         if (typeof APP !== 'undefined') {
44
         if (typeof APP !== 'undefined') {
45
             APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK, action.locked);
45
             APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK, action.locked);
46
         }
46
         }
47
-
48
         break;
47
         break;
49
-    }
48
+
50
     case SET_PASSWORD_FAILED:
49
     case SET_PASSWORD_FAILED:
51
-        return _notifySetPasswordError(store, next, action);
50
+        return _setPasswordFailed(store, next, action);
52
     }
51
     }
53
 
52
 
54
     return next(action);
53
     return next(action);
55
 });
54
 });
56
 
55
 
57
 /**
56
 /**
58
- * Handles errors that occur when a password is failed to be set.
57
+ * Handles errors that occur when a password fails to be set.
59
  *
58
  *
60
  * @param {Store} store - The Redux store in which the specified action is being
59
  * @param {Store} store - The Redux store in which the specified action is being
61
  * dispatched.
60
  * dispatched.
67
  * @returns {Object} The new state that is the result of the reduction of the
66
  * @returns {Object} The new state that is the result of the reduction of the
68
  * specified action.
67
  * specified action.
69
  */
68
  */
70
-function _notifySetPasswordError(store, next, action) {
69
+function _setPasswordFailed(store, next, action) {
71
     if (typeof APP !== 'undefined') {
70
     if (typeof APP !== 'undefined') {
72
-        // TODO remove this logic when displaying of error messages on web is
73
-        // handled through react/redux
74
-        if (action.error
75
-            === JitsiMeetJS.errors.conference.PASSWORD_NOT_SUPPORTED) {
71
+        // TODO Remove this logic when displaying of error messages on web is
72
+        // handled through react/redux.
73
+        const { error } = action;
74
+        let title;
75
+        let message;
76
+
77
+        if (error === JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED) {
76
             logger.warn('room passwords not supported');
78
             logger.warn('room passwords not supported');
77
-            APP.UI.messageHandler.showError(
78
-                'dialog.warning', 'dialog.passwordNotSupported');
79
+            title = 'dialog.warning';
80
+            message = 'dialog.passwordNotSupported';
79
         } else {
81
         } else {
80
-            logger.warn('setting password failed', action.error);
81
-            APP.UI.messageHandler.showError(
82
-                'dialog.lockTitle', 'dialog.lockMessage');
82
+            logger.warn('setting password failed', error);
83
+            title = 'dialog.lockTitle';
84
+            message = 'dialog.lockMessage';
83
         }
85
         }
86
+        APP.UI.messageHandler.showError(title, message);
84
     }
87
     }
85
 
88
 
86
     return next(action);
89
     return next(action);

Ładowanie…
Anuluj
Zapisz