ソースを参照

[RN] Add unlock room function to mobile

master
Zoltan Bettenbuk 7年前
コミット
192f1d44f5

+ 1
- 0
lang/main.json ファイルの表示

@@ -230,6 +230,7 @@
230 230
         "rejoinNow": "Rejoin now",
231 231
         "maxUsersLimitReachedTitle": "Maximum members limit reached",
232 232
         "maxUsersLimitReached": "The limit for maximum number of members has been reached. The conference is full. Please contact the meeting owner or try again later!",
233
+        "lockRoom": "Lock room",
233 234
         "lockTitle": "Lock failed",
234 235
         "lockMessage": "Failed to lock the conference.",
235 236
         "warning": "Warning",

+ 17
- 0
react/features/room-lock/actions.js ファイルの表示

@@ -98,3 +98,20 @@ export function endRoomLockRequest(
98 98
 export function _openPasswordRequiredPrompt(conference: Object) {
99 99
     return openDialog(PasswordRequiredPrompt, { conference });
100 100
 }
101
+
102
+/**
103
+ * Unlocks the current jitsi conference.
104
+ *
105
+ * @returns {Function}
106
+ */
107
+export function unlockRoom() {
108
+    return (dispatch: Dispatch<Function>, getState: Function) => {
109
+        const { conference } = getState()['features/base/conference'];
110
+
111
+        return dispatch(setPassword(
112
+            conference,
113
+            conference.lock,
114
+            ''
115
+        ));
116
+    };
117
+}

+ 17
- 7
react/features/room-lock/components/RoomLockButton.js ファイルの表示

@@ -3,17 +3,19 @@
3 3
 import { connect } from 'react-redux';
4 4
 
5 5
 import { translate } from '../../base/i18n';
6
+import { isLocalParticipantModerator } from '../../base/participants';
6 7
 import { AbstractButton } from '../../base/toolbox';
7 8
 import type { AbstractButtonProps } from '../../base/toolbox';
8 9
 
9
-import { beginRoomLockRequest } from '../actions';
10
+import { beginRoomLockRequest, unlockRoom } from '../actions';
10 11
 
11 12
 type Props = AbstractButtonProps & {
12 13
 
13 14
     /**
14
-     * The current conference.
15
+     * Whether the current local participant is a moderator, therefore is
16
+     * allowed to lock or unlock the conference.
15 17
      */
16
-    _conference: Object,
18
+    _localParticipantModerator: boolean,
17 19
 
18 20
     /**
19 21
      * Whether the current conference is locked or not.
@@ -43,7 +45,13 @@ class RoomLockButton extends AbstractButton<Props, *> {
43 45
      * @returns {void}
44 46
      */
45 47
     _handleClick() {
46
-        this.props.dispatch(beginRoomLockRequest());
48
+        const { dispatch, _locked } = this.props;
49
+
50
+        if (_locked) {
51
+            dispatch(unlockRoom());
52
+        } else {
53
+            dispatch(beginRoomLockRequest());
54
+        }
47 55
     }
48 56
 
49 57
     /**
@@ -54,7 +62,7 @@ class RoomLockButton extends AbstractButton<Props, *> {
54 62
      * @returns {boolean}
55 63
      */
56 64
     _isDisabled() {
57
-        return !this.props._conference;
65
+        return !this.props._localParticipantModerator;
58 66
     }
59 67
 
60 68
     /**
@@ -76,14 +84,16 @@ class RoomLockButton extends AbstractButton<Props, *> {
76 84
  * @param {Object} state - The Redux state.
77 85
  * @private
78 86
  * @returns {{
79
- *     _audioOnly: boolean
87
+ *     _localParticipantModerator: boolean,
88
+ *     _locked: boolean
80 89
  * }}
81 90
  */
82 91
 function _mapStateToProps(state): Object {
83 92
     const { conference, locked } = state['features/base/conference'];
84 93
 
85 94
     return {
86
-        _conference: conference,
95
+        _localParticipantModerator:
96
+            Boolean(conference && isLocalParticipantModerator(state)),
87 97
         _locked: Boolean(conference && locked)
88 98
     };
89 99
 }

+ 1
- 1
react/features/room-lock/components/RoomLockPrompt.native.js ファイルの表示

@@ -65,7 +65,7 @@ class RoomLockPrompt extends Component<*> {
65 65
                 onCancel = { this._onCancel }
66 66
                 onSubmit = { this._onSubmit }
67 67
                 textInputProps = { _TEXT_INPUT_PROPS }
68
-                titleKey = 'toolbar.lock' />
68
+                titleKey = 'dialog.lockRoom' />
69 69
         );
70 70
     }
71 71
 

読み込み中…
キャンセル
保存