diff --git a/CHANGES.md b/CHANGES.md index af4846bdf..1e729770c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,11 +18,12 @@ - Message deduplication bugfixes and improvements - Continuously retry (in 2s intervals) to fetch login credentials (via [credentials_url](https://conversejs.org/docs/html/configuration.html#credentials-url)) in case of failure - Replace `moment` with [DayJS](https://github.com/iamkun/dayjs). -- New config option [auto_focus](https://conversejs.org/docs/html/configuration.html#auto-focus). -- New config option [enable_smacks](https://conversejs.org/docs/html/configuration.html#enable-smacks). +- New config option [auto_focus](https://conversejs.org/docs/html/configuration.html#auto-focus) +- New config option [enable_smacks](https://conversejs.org/docs/html/configuration.html#enable-smacks) - New config option [muc_show_join_leave_status](https://conversejs.org/docs/html/configuration.html#muc-show-join-leave-status) - New config option [message_limit](https://conversejs.org/docs/html/configuration.html#message-limit) -- New config option [singleton](https://conversejs.org/docs/html/configuration.html#singleton). +- New config option [singleton](https://conversejs.org/docs/html/configuration.html#singleton) +- New config option [muc_mention_autocomplete_min_chars](https://conversejs.org/docs/html/configuration.html#muc-mention-autocomplete-min-chars) By setting this option to `false` and `view_mode` to `'embedded'`, it's now possible to "embed" the full app and not just a single chat. To embed just a single chat, it's now necessary to explicitly set `singleton` to `true`. @@ -43,6 +44,7 @@ - #1554: Room auto-configuration broke if the config form contained fields with type `fixed` - #1558: `this.get` is not a function error when `forward_messages` is set to `true`. - #1572: In `fullscreen` view mode the top is cut off on iOS +- #1575: MUC invitation autocomplete list doesn't appear - #1576: Converse gets stuck with spinner when logging out with `auto_login` set to `true` - #1579: Trim spaces at the beginning and end of a JID (when adding contact) - #1586: Not possible to kick someone with a space in their nickname diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 7d3b1422e..5aa30bcf4 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -837,6 +837,14 @@ VCard is taken, and if that is not set but `muc_nickname_from_jid`_ is set to If no nickame value is found, then an error will be raised. +muc_mention_autocomplete_min_chars +----------------------------------- + +* Default: ``0`` + +The number of characters that need to be entered before the auto-complete list +of matching nicknames is shown. + message_archiving ----------------- diff --git a/src/converse-autocomplete.js b/src/converse-autocomplete.js index fcb60173b..beff948cb 100644 --- a/src/converse-autocomplete.js +++ b/src/converse-autocomplete.js @@ -325,6 +325,7 @@ converse.plugins.add("converse-autocomplete", { ev.keyCode === _converse.keycodes.UP_ARROW || ev.keyCode === _converse.keycodes.DOWN_ARROW ); + if (!this.auto_evaluate && !this.auto_completing || selecting) { return; } @@ -335,14 +336,15 @@ converse.plugins.add("converse-autocomplete", { } let value = this.match_current_word ? u.getCurrentWord(this.input) : this.input.value; - - let ignore_min_chars = false; - if (this.ac_triggers.includes(value[0]) && !this.include_triggers.includes(ev.key)) { - ignore_min_chars = true; - value = value.slice('1'); + const contains_trigger = this.ac_triggers.includes(value[0]); + if (contains_trigger) { + this.auto_completing = true; + if (!this.include_triggers.includes(ev.key)) { + value = value.slice('1'); + } } - if ((value.length >= this.min_chars) || ignore_min_chars) { + if ((contains_trigger || value.length) && value.length >= this.min_chars) { this.index = -1; // Populate list with options that match this.ul.innerHTML = ""; @@ -364,7 +366,9 @@ converse.plugins.add("converse-autocomplete", { } } else { this.close({'reason': 'nomatches'}); - this.auto_completing = false; + if (!contains_trigger) { + this.auto_completing = false; + } } } } diff --git a/src/converse-muc-views.js b/src/converse-muc-views.js index a70d5cbad..0e2ad1dec 100644 --- a/src/converse-muc-views.js +++ b/src/converse-muc-views.js @@ -105,6 +105,7 @@ converse.plugins.add('converse-muc-views', { 'muc_disable_slash_commands': false, 'muc_show_join_leave': true, 'muc_show_join_leave_status': true, + 'muc_mention_autocomplete_min_chars': 0, 'roomconfig_whitelist': [], 'visible_toolbar_buttons': { 'toggle_occupants': true @@ -570,7 +571,7 @@ converse.plugins.add('converse-muc-views', { this.mention_auto_complete = new _converse.AutoComplete(this.el, { 'auto_first': true, 'auto_evaluate': false, - 'min_chars': 1, + 'min_chars': _converse.muc_mention_autocomplete_min_chars, 'match_current_word': true, 'list': () => this.getAutoCompleteList(), 'filter': _converse.FILTER_STARTSWITH, @@ -1859,10 +1860,9 @@ converse.plugins.add('converse-muc-views', { 'list': list }); this.invite_auto_complete.on('suggestion-box-selectcomplete', ev => this.promptForInvite(ev)); - this.invite_auto_complete.ul.setAttribute( - 'style', - `max-height: calc(${this.el.offsetHeight}px - 80px);` - ); + this.invite_auto_complete.on('suggestion-box-open', ev => { + this.invite_auto_complete.ul.setAttribute('style', `max-height: calc(${this.el.offsetHeight}px - 80px);`); + }); } }); diff --git a/src/headless/converse-chatboxes.js b/src/headless/converse-chatboxes.js index 16a93f94e..d626e3a35 100644 --- a/src/headless/converse-chatboxes.js +++ b/src/headless/converse-chatboxes.js @@ -984,7 +984,7 @@ converse.plugins.add('converse-chatboxes', { }, onChatBoxesFetched (collection) { - /* Show chat boxes upon receiving them from sessionStorage */ + /* Show chat boxes upon receiving them from storage */ collection.filter(c => !c.isValid()).forEach(c => c.destroy()); collection.forEach(c => c.maybeShow()); /** diff --git a/src/headless/converse-muc.js b/src/headless/converse-muc.js index 30042ac54..008619e21 100644 --- a/src/headless/converse-muc.js +++ b/src/headless/converse-muc.js @@ -2000,7 +2000,7 @@ converse.plugins.add('converse-muc', { * JIDs of the chatroom(s) to create * @param {object} [attrs] attrs The room attributes */ - 'create' (jids, attrs) { + create (jids, attrs) { if (_.isString(attrs)) { attrs = {'nick': attrs}; } else if (_.isUndefined(attrs)) {