Skip to content

Commit 8dc8b1d

Browse files
committed
Insert only the MUC JID when clicking an auto-complete suggestion
1 parent d2b4f2e commit 8dc8b1d

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/plugins/muc-views/modals/add-muc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export default BootstrapModal.extend({
3232
placeholder = muc_domain ? `name@${muc_domain}` : __('[email protected]');
3333
}
3434
return tpl_add_muc(Object.assign(this.model.toJSON(), {
35-
'_converse': _converse,
3635
'label_room_address': api.settings.get('muc_domain') ? __('Groupchat name') : __('Groupchat address'),
3736
'chatroom_placeholder': placeholder,
3837
'muc_roomid_policy_error_msg': this.muc_roomid_policy_error_msg,

src/plugins/muc-views/search.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ async function searchRooms (query) {
4141
return [];
4242
}
4343
const s = `result[xmlns="${Strophe.NS.MUCSEARCH}"] item`;
44-
return sizzle(s, iq_result).map(i => `${i.querySelector('name')?.textContent} (${i.getAttribute('address')})`);
44+
return sizzle(s, iq_result).map(i => {
45+
const jid = i.getAttribute('address');
46+
return {
47+
'label': `${i.querySelector('name')?.textContent} (${jid})`,
48+
'value': jid
49+
}
50+
});
4551
}
4652

4753
export function getAutoCompleteList (query) {
@@ -50,4 +56,3 @@ export function getAutoCompleteList (query) {
5056
}
5157
return rooms_cache[query];
5258
}
53-

src/plugins/muc-views/templates/add-muc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default (o) => {
3636
<label for="chatroom">${o.label_room_address}:</label>
3737
${ (o.muc_roomid_policy_error_msg) ? html`<label class="roomid-policy-error">${o.muc_roomid_policy_error_msg}</label>` : '' }
3838
<converse-autocomplete
39-
.getAutoCompleteList="${getAutoCompleteList}"
39+
.getAutoCompleteList=${getAutoCompleteList}
4040
?autofocus=${true}
4141
min_chars="3"
4242
position="below"

src/shared/autocomplete/autocomplete.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export class AutoComplete {
5959
}
6060

6161
bindEvents () {
62-
// Bind events
6362
const input = {
6463
"blur": () => this.close({'reason': 'blur'})
6564
}

0 commit comments

Comments
 (0)