Sfoglia il codice sorgente

Fixes inviting more than one participant (#4352)

* Fixes inviting more than one participant.

* Shows a notification when participants are invited.

* Adds support for both .id and .user_id props for people query results.
master
Дамян Минков 5 anni fa
parent
commit
08c4933c1b
Nessun account collegato all'indirizzo email del committer

+ 3
- 0
lang/main.json Vedi File

@@ -472,6 +472,9 @@
472 472
         "focus": "Conference focus",
473 473
         "focusFail": "__component__ not available - retry in __ms__ sec",
474 474
         "grantedTo": "Moderator rights granted to __to__!",
475
+        "invitedOneMember": "__name__ has been invited",
476
+        "invitedThreePlusMembers": "__name__ and __count__ others have been invited",
477
+        "invitedTwoMembers": "__first__ and __second__ have been invited",
475 478
         "kickParticipant": "__kicked__ was kicked by __kicker__",
476 479
         "me": "Me",
477 480
         "moderator": "Moderator rights granted!",

+ 45
- 1
react/features/invite/components/add-people-dialog/AbstractAddPeopleDialog.js Vedi File

@@ -11,6 +11,10 @@ import {
11 11
     isAddPeopleEnabled,
12 12
     isDialOutEnabled
13 13
 } from '../../functions';
14
+import {
15
+    NOTIFICATION_TIMEOUT,
16
+    showNotification
17
+} from '../../../notifications';
14 18
 
15 19
 const logger = require('jitsi-meet-logger').getLogger(__filename);
16 20
 
@@ -21,6 +25,11 @@ export type Props = {
21 25
      */
22 26
     _addPeopleEnabled: boolean,
23 27
 
28
+    /**
29
+     * Whether or not call flows are enabled.
30
+     */
31
+    _callFlowsEnabled: boolean,
32
+
24 33
     /**
25 34
      * The URL for validating if a phone number can be called.
26 35
      */
@@ -115,7 +124,7 @@ export default class AbstractAddPeopleDialog<P: Props, S: State>
115 124
             addToCallInProgress: true
116 125
         });
117 126
 
118
-        const { dispatch } = this.props;
127
+        const { _callFlowsEnabled, dispatch } = this.props;
119 128
 
120 129
         return dispatch(invite(invitees))
121 130
             .then(invitesLeftToSend => {
@@ -140,6 +149,39 @@ export default class AbstractAddPeopleDialog<P: Props, S: State>
140 149
                     this.setState({
141 150
                         addToCallError: true
142 151
                     });
152
+                } else if (!_callFlowsEnabled) {
153
+                    const invitedCount = invitees.length;
154
+                    let notificationProps;
155
+
156
+                    if (invitedCount >= 3) {
157
+                        notificationProps = {
158
+                            titleArguments: {
159
+                                name: invitees[0].name,
160
+                                count: invitedCount - 1
161
+                            },
162
+                            titleKey: 'notify.invitedThreePlusMembers'
163
+                        };
164
+                    } else if (invitedCount === 2) {
165
+                        notificationProps = {
166
+                            titleArguments: {
167
+                                first: invitees[0].name,
168
+                                second: invitees[1].name
169
+                            },
170
+                            titleKey: 'notify.invitedTwoMembers'
171
+                        };
172
+                    } else if (invitedCount) {
173
+                        notificationProps = {
174
+                            titleArguments: {
175
+                                name: invitees[0].name
176
+                            },
177
+                            titleKey: 'notify.invitedOneMember'
178
+                        };
179
+                    }
180
+
181
+                    if (notificationProps) {
182
+                        dispatch(
183
+                            showNotification(notificationProps, NOTIFICATION_TIMEOUT));
184
+                    }
143 185
                 }
144 186
 
145 187
                 return invitesLeftToSend;
@@ -206,6 +248,7 @@ export default class AbstractAddPeopleDialog<P: Props, S: State>
206 248
  */
207 249
 export function _mapStateToProps(state: Object) {
208 250
     const {
251
+        callFlowsEnabled,
209 252
         dialOutAuthUrl,
210 253
         peopleSearchQueryTypes,
211 254
         peopleSearchUrl
@@ -213,6 +256,7 @@ export function _mapStateToProps(state: Object) {
213 256
 
214 257
     return {
215 258
         _addPeopleEnabled: isAddPeopleEnabled(state),
259
+        _callFlowsEnabled: callFlowsEnabled,
216 260
         _dialOutAuthUrl: dialOutAuthUrl,
217 261
         _dialOutEnabled: isDialOutEnabled(state),
218 262
         _jwt: state['features/base/jwt'].jwt,

+ 8
- 5
react/features/invite/components/add-people-dialog/native/AddPeopleDialog.js Vedi File

@@ -212,7 +212,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
212 212
      * @returns {string}
213 213
      */
214 214
     _keyExtractor(item) {
215
-        return item.type === 'user' ? item.user_id : item.number;
215
+        return item.type === 'user' ? item.id || item.user_id : item.number;
216 216
     }
217 217
 
218 218
     _onCloseAddPeopleDialog: () => void
@@ -315,8 +315,9 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
315 315
                         && !inviteItems.find(
316 316
                             _.matchesProperty('number', result.number));
317 317
                 case 'user':
318
-                    return result.user_id && !inviteItems.find(
319
-                        _.matchesProperty('user_id', result.user_id));
318
+                    return !inviteItems.find(
319
+                        (result.user_id && _.matchesProperty('id', result.id))
320
+                        || (result.user_id && _.matchesProperty('user_id', result.user_id)));
320 321
                 default:
321 322
                     return false;
322 323
                 }
@@ -367,10 +368,12 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
367 368
             break;
368 369
         case 'user':
369 370
             selected
370
-                = inviteItems.find(_.matchesProperty('user_id', item.user_id));
371
+                = item.id
372
+                    ? inviteItems.find(_.matchesProperty('id', item.id))
373
+                    : inviteItems.find(_.matchesProperty('user_id', item.user_id));
371 374
             renderableItem = {
372 375
                 avatar: item.avatar,
373
-                key: item.user_id,
376
+                key: item.id || item.user_id,
374 377
                 title: item.name
375 378
             };
376 379
             break;

+ 3
- 3
react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js Vedi File

@@ -254,10 +254,10 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
254 254
                 if (invitesLeftToSend.length) {
255 255
                     const unsentInviteIDs
256 256
                         = invitesLeftToSend.map(invitee =>
257
-                            invitee.id || invitee.number);
257
+                            invitee.id || invitee.user_id || invitee.number);
258 258
                     const itemsToSelect
259 259
                         = inviteItems.filter(({ item }) =>
260
-                            unsentInviteIDs.includes(item.id || item.number));
260
+                            unsentInviteIDs.includes(item.id || item.user_id || item.number));
261 261
 
262 262
                     if (this._multiselect) {
263 263
                         this._multiselect.setSelectedItems(itemsToSelect);
@@ -296,7 +296,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
296 296
                         size = 'xsmall'
297 297
                         src = { user.avatar } />
298 298
                 },
299
-                value: user.id
299
+                value: user.id || user.user_id
300 300
             };
301 301
         });
302 302
 

Loading…
Annulla
Salva