Pārlūkot izejas kodu

fix(peopleSearch): queryTypes are defined in config.js

master
hristoterezov 7 gadus atpakaļ
vecāks
revīzija
cd3dad956b

+ 33
- 9
react/features/invite/components/AddPeopleDialog.web.js Parādīt failu

14
 
14
 
15
 declare var interfaceConfig: Object;
15
 declare var interfaceConfig: Object;
16
 
16
 
17
+const { PropTypes } = React;
18
+
17
 /**
19
 /**
18
  * The dialog that allows to invite people to the call.
20
  * The dialog that allows to invite people to the call.
19
  */
21
  */
27
         /**
29
         /**
28
          * The URL pointing to the service allowing for people invite.
30
          * The URL pointing to the service allowing for people invite.
29
          */
31
          */
30
-        _inviteServiceUrl: React.PropTypes.string,
32
+        _inviteServiceUrl: PropTypes.string,
31
 
33
 
32
         /**
34
         /**
33
          * The url of the conference to invite people to.
35
          * The url of the conference to invite people to.
34
          */
36
          */
35
-        _inviteUrl: React.PropTypes.string,
37
+        _inviteUrl: PropTypes.string,
36
 
38
 
37
         /**
39
         /**
38
          * The JWT token.
40
          * The JWT token.
39
          */
41
          */
40
-        _jwt: React.PropTypes.string,
42
+        _jwt: PropTypes.string,
43
+
44
+        /**
45
+         * The query types used when searching people.
46
+         */
47
+        _peopleSearchQueryTypes: PropTypes.arrayOf(PropTypes.string),
41
 
48
 
42
         /**
49
         /**
43
          * The URL pointing to the service allowing for people search.
50
          * The URL pointing to the service allowing for people search.
44
          */
51
          */
45
-        _peopleSearchUrl: React.PropTypes.string,
52
+        _peopleSearchUrl: PropTypes.string,
46
 
53
 
47
         /**
54
         /**
48
          * The function closing the dialog.
55
          * The function closing the dialog.
49
          */
56
          */
50
-        hideDialog: React.PropTypes.func,
57
+        hideDialog: PropTypes.func,
51
 
58
 
52
         /**
59
         /**
53
          * Invoked to obtain translated strings.
60
          * Invoked to obtain translated strings.
54
          */
61
          */
55
-        t: React.PropTypes.func
62
+        t: PropTypes.func
56
     };
63
     };
57
 
64
 
58
     /**
65
     /**
84
 
91
 
85
         this._multiselect = null;
92
         this._multiselect = null;
86
         this._resourceClient = {
93
         this._resourceClient = {
87
-            makeQuery: text => searchPeople(
88
-                this.props._peopleSearchUrl, this.props._jwt, text),
94
+            makeQuery: text => {
95
+                const {
96
+                    _jwt,
97
+                    _peopleSearchQueryTypes,
98
+                    _peopleSearchUrl
99
+                } = this.props;
100
+
101
+                return searchPeople(
102
+                    _peopleSearchUrl,
103
+                    _jwt,
104
+                    text,
105
+                    _peopleSearchQueryTypes
106
+                );
107
+            },
89
             parseResults: response => response.map(user => {
108
             parseResults: response => response.map(user => {
90
                 const avatar = ( // eslint-disable-line no-extra-parens
109
                 const avatar = ( // eslint-disable-line no-extra-parens
91
                     <Avatar
110
                     <Avatar
299
  * }}
318
  * }}
300
  */
319
  */
301
 function _mapStateToProps(state) {
320
 function _mapStateToProps(state) {
302
-    const { peopleSearchUrl, inviteServiceUrl } = state['features/base/config'];
321
+    const {
322
+        inviteServiceUrl,
323
+        peopleSearchQueryTypes,
324
+        peopleSearchUrl
325
+     } = state['features/base/config'];
303
 
326
 
304
     return {
327
     return {
305
         _jwt: state['features/jwt'].jwt,
328
         _jwt: state['features/jwt'].jwt,
306
         _inviteUrl: getInviteURL(state),
329
         _inviteUrl: getInviteURL(state),
307
         _inviteServiceUrl: inviteServiceUrl,
330
         _inviteServiceUrl: inviteServiceUrl,
331
+        _peopleSearchQueryTypes: peopleSearchQueryTypes,
308
         _peopleSearchUrl: peopleSearchUrl
332
         _peopleSearchUrl: peopleSearchUrl
309
     };
333
     };
310
 }
334
 }

+ 10
- 3
react/features/invite/functions.js Parādīt failu

6
  * @param {string} serviceUrl - The service to query.
6
  * @param {string} serviceUrl - The service to query.
7
  * @param {string} jwt - The jwt token to pass to the search service.
7
  * @param {string} jwt - The jwt token to pass to the search service.
8
  * @param {string} text - Text to search.
8
  * @param {string} text - Text to search.
9
+ * @param {Array<string>} queryTypes - Array with the query types that will be
10
+ * executed - "conferenceRooms" | "user" | "room".
9
  * @returns {Promise} - The promise created by the request.
11
  * @returns {Promise} - The promise created by the request.
10
  */
12
  */
11
-export function searchPeople(serviceUrl, jwt, text) {
12
-    const queryTypes = '["conferenceRooms","user","room"]';
13
+export function searchPeople(// eslint-disable-line max-params
14
+    serviceUrl,
15
+    jwt,
16
+    text,
17
+    queryTypes = [ 'conferenceRooms', 'user', 'room' ]
18
+) {
19
+    const queryTypesString = JSON.stringify(queryTypes);
13
 
20
 
14
     return new Promise((resolve, reject) => {
21
     return new Promise((resolve, reject) => {
15
         $.getJSON(`${serviceUrl}?query=${encodeURIComponent(text)}`
22
         $.getJSON(`${serviceUrl}?query=${encodeURIComponent(text)}`
16
-            + `&queryTypes=${queryTypes}&jwt=${jwt}`,
23
+            + `&queryTypes=${queryTypesString}&jwt=${jwt}`,
17
         response => resolve(response)
24
         response => resolve(response)
18
         ).fail((jqxhr, textStatus, error) =>
25
         ).fail((jqxhr, textStatus, error) =>
19
             reject(error)
26
             reject(error)

Notiek ielāde…
Atcelt
Saglabāt