Commit 7a36acad authored by ChaosKid42's avatar ChaosKid42 Committed by JC Brand

remove "?" from user-search-query (#1103)

parent d339a06e
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
[statusMessageChanged](https://conversejs.org/docs/html/events.html#contactstatusmessagechanged) [statusMessageChanged](https://conversejs.org/docs/html/events.html#contactstatusmessagechanged)
event and make the XMLHttpRequest yourself. event and make the XMLHttpRequest yourself.
- Removed `xhr_user_search` in favor of only accepting `xhr_user_search_url` as configuration option. - Removed `xhr_user_search` in favor of only accepting `xhr_user_search_url` as configuration option.
- `xhr_user_search_url` has to include the `?` character now in favor of more
flexibility. See example in the documentation.
- The data returned from the `xhr_user_search_url` must now include the user's - The data returned from the `xhr_user_search_url` must now include the user's
`jid` instead of just an `id`. `jid` instead of just an `id`.
- New configuration settings [nickname](https://conversejs.org/docs/html/configurations.html#nickname) - New configuration settings [nickname](https://conversejs.org/docs/html/configurations.html#nickname)
......
...@@ -1587,3 +1587,18 @@ This is the URL to which an XHR GET request will be made to fetch user data from ...@@ -1587,3 +1587,18 @@ This is the URL to which an XHR GET request will be made to fetch user data from
The query string will be included in the request with ``q`` as its key. The query string will be included in the request with ``q`` as its key.
The data returned must be a JSON encoded list of user JIDs. The data returned must be a JSON encoded list of user JIDs.
.. note::
converse.js will construct the XHR get URL by simply appending
``q=<query string entered>`` to the URL given by ``xhr_user_search_url``.
It is therefore important that the necessary question mark (``?``) preceding the
URL's query component or necessary delimiters (``&``) are included. See valid
examples below.
Examples:
.. code-block:: javascript
xhr_user_search_url: 'https://some.url/some_path?',
xhr_user_search_url: 'https://some.url/some_path?api_key=somekey&',
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
} }
}; };
name_input.addEventListener('input', _.debounce(() => { name_input.addEventListener('input', _.debounce(() => {
xhr.open("GET", `${_converse.xhr_user_search_url}?q=${name_input.value}`, true); xhr.open("GET", `${_converse.xhr_user_search_url}q=${name_input.value}`, true);
xhr.send() xhr.send()
} , 300)); } , 300));
this.el.addEventListener('awesomplete-selectcomplete', (ev) => { this.el.addEventListener('awesomplete-selectcomplete', (ev) => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment