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

This commit is contained in:
ChaosKid42 2018-05-17 18:26:06 +02:00 committed by JC Brand
parent d339a06ea7
commit 7a36acade5
3 changed files with 18 additions and 1 deletions

View File

@ -41,6 +41,8 @@
[statusMessageChanged](https://conversejs.org/docs/html/events.html#contactstatusmessagechanged)
event and make the XMLHttpRequest yourself.
- 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
`jid` instead of just an `id`.
- New configuration settings [nickname](https://conversejs.org/docs/html/configurations.html#nickname)

View File

@ -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 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&',

View File

@ -191,7 +191,7 @@
}
};
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()
} , 300));
this.el.addEventListener('awesomplete-selectcomplete', (ev) => {