Skip to content

Commit

Permalink
Add new config setting muc_search_service
Browse files Browse the repository at this point in the history
Lets you configure which JID to use when searching for MUCs for
auto-complete purposes.

Fixes #3305
  • Loading branch information
jcbrand committed Feb 27, 2024
1 parent 37ef76f commit c6fcace
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
- #3033: Add the `muc_grouped_by_domain` option to display MUCs on the same domain in collapsible groups
- #3300: Adding the maxWait option for `debouncedPruneHistory`
- #3302: debounce MUC sidebar rendering
- #3305: New config option [muc_search_service](https://conversejs.org/docs/html/configuration.html#muc-search-service)
- #3307: Fix inconsistency between browsers on textarea outlines
- Add an occupants filter to the MUC sidebar
- Fix: MUC occupant list does not sort itself on nicknames or roles changes
- Fix: refresh the MUC sidebar when participants collection is sorted
- Fix: room information not correctly refreshed when modifications are made by other users
-

### Breaking changes:

Expand Down
11 changes: 11 additions & 0 deletions docs/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,17 @@ automatically be "john". If now [email protected] tries to join the
room, his nickname will be "john-2", and if [email protected] joins, then
his nickname will be "john-3", and so forth.


muc_search_service
------------------

* Default: ``'[email protected]'``

The JID of the service that should be used to search for MUCs for auto-complete
purposes. If this value is set to an empty string, no service will be used and
the auto-complete feature for adding MUCs will be disabled.


muc_send_probes
---------------

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/bookmark-views/modals/bookmark-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { api } from "@converse/headless";

export default class BookmarkListModal extends BaseModal {

renderModal () { // eslint-disable-line class-methods-use-this
renderModal () {
return html`<converse-bookmarks></converse-bookmarks>`;
}

getModalTitle () { // eslint-disable-line class-methods-use-this
getModalTitle () {
return __('Bookmarks');
}
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/muc-views/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ converse.plugins.add('converse-muc-views', {
'muc_mention_autocomplete_show_avatar': true,
'muc_roomid_policy': null,
'muc_roomid_policy_hint': null,
'muc_search_service': '[email protected]',
'roomconfig_whitelist': [],
'show_retraction_warning': true,
'visible_toolbar_buttons': {
Expand Down
23 changes: 13 additions & 10 deletions src/plugins/muc-views/modals/templates/add-muc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,26 @@ export default (el) => {
const label_room_address = muc_domain ? __('Groupchat name') : __('Groupchat address');
const muc_roomid_policy_error_msg = el.muc_roomid_policy_error_msg;
const muc_roomid_policy_hint = api.settings.get('muc_roomid_policy_hint');
const muc_search_service = api.settings.get('muc_search_service');
return html`
<form class="converse-form add-chatroom" @submit=${(ev) => el.openChatRoom(ev)}>
<div class="form-group">
<label for="chatroom">${label_room_address}:</label>
${muc_roomid_policy_error_msg
? html`<label class="roomid-policy-error">${muc_roomid_policy_error_msg}</label>`
: ''}
<converse-autocomplete
.getAutoCompleteList=${getAutoCompleteList}
?autofocus=${true}
min_chars="3"
position="below"
placeholder="${placeholder}"
class="add-muc-autocomplete"
name="chatroom"
>
</converse-autocomplete>
${muc_search_service
? html` <converse-autocomplete
.getAutoCompleteList=${getAutoCompleteList}
?autofocus=${true}
min_chars="3"
position="below"
placeholder="${placeholder}"
class="add-muc-autocomplete"
name="chatroom"
>
</converse-autocomplete>`
: ''}
</div>
${muc_roomid_policy_hint
? html`<div class="form-group">
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/muc-views/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ const rooms_cache = {};
* @param {string} query
*/
async function searchRooms (query) {
const muc_search_service = api.settings.get('muc_search_service');
const bare_jid = _converse.session.get('bare_jid');
const iq = $iq({
'type': 'get',
'from': bare_jid,
'to': '[email protected]'
'to': muc_search_service,
}).c('search', { 'xmlns': Strophe.NS.MUCSEARCH })
.c('set', { 'xmlns': Strophe.NS.RSM })
.c('max').t(10).up().up()
Expand Down

0 comments on commit c6fcace

Please sign in to comment.