Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
5e8843e8
Commit
5e8843e8
authored
Mar 26, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`xhr_user_search_url` fixes after some real world testing
parent
e21f14f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
src/converse-rosterview.js
src/converse-rosterview.js
+12
-7
No files found.
src/converse-rosterview.js
View file @
5e8843e8
...
...
@@ -153,16 +153,21 @@
afterRender
()
{
const
input_el
=
this
.
el
.
querySelector
(
'
input[name="jid"]
'
);
if
(
_converse
.
xhr_user_search_url
&&
_
.
isString
(
_converse
.
xhr_user_search_url
))
{
const
awesomplete
=
new
Awesomplete
(
input_el
,
{
'
list
'
:
[]
,
'
minChars
'
:
2
});
const
awesomplete
=
new
Awesomplete
(
input_el
,
{
'
list
'
:
[]});
const
xhr
=
new
window
.
XMLHttpRequest
();
// `open` must be called after `onload` for
// mock/testing purposes.
// `open` must be called after `onload` for mock/testing purposes.
xhr
.
onload
=
function
()
{
awesomplete
.
list
=
JSON
.
parse
(
xhr
.
responseText
).
map
((
i
)
=>
i
.
jid
);
awesomplete
.
evaluate
();
if
(
xhr
.
responseText
)
{
awesomplete
.
list
=
JSON
.
parse
(
xhr
.
responseText
).
map
((
i
)
=>
{
return
{
'
label
'
:
i
.
fullname
,
'
value
'
:
i
.
jid
};
});
awesomplete
.
evaluate
();
}
};
xhr
.
open
(
"
GET
"
,
_converse
.
xhr_user_search_url
,
true
);
input_el
.
addEventListener
(
'
input
'
,
_
.
debounce
(()
=>
xhr
.
send
()),
100
,
{
'
leading
'
:
true
});
input_el
.
addEventListener
(
'
input
'
,
_
.
debounce
(()
=>
{
xhr
.
open
(
"
GET
"
,
`
${
_converse
.
xhr_user_search_url
}
?q=
${
input_el
.
value
}
`
,
true
);
xhr
.
send
()
}
,
500
));
}
else
{
const
list
=
_
.
uniq
(
_converse
.
roster
.
map
((
item
)
=>
Strophe
.
getDomainFromJid
(
item
.
get
(
'
jid
'
))));
new
Awesomplete
(
input_el
,
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment