diff --git a/CHANGES.md b/CHANGES.md index c14fc6392..e1523f104 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ - Fix trimming of chats in overlayed view mode - #2647: Singleton mode doesn't work - OMEMO bugfix: Always create device session based on real JID. +- If `auto_register_muc_nickname` is set, make sure to register when the user changes current nick. - Emit a `change` event when a configuration setting changes - 3 New configuration settings: diff --git a/src/headless/plugins/muc/muc.js b/src/headless/plugins/muc/muc.js index f6a22fbcd..17d5b9634 100644 --- a/src/headless/plugins/muc/muc.js +++ b/src/headless/plugins/muc/muc.js @@ -1404,8 +1404,12 @@ const ChatRoomMixin = { }, async setNickname (nick) { - this.set({ nick }); - if (this.features.get('membersonly')) { + if ( + api.settings.get('auto_register_muc_nickname') && + (await api.disco.supports(Strophe.NS.MUC_REGISTER, this.get('jid'))) + ) { + const old_nick = this.get('nick'); + this.set({ nick }); try { await this.registerNickname(); } catch (e) { @@ -1413,6 +1417,7 @@ const ChatRoomMixin = { log.error(e); const message = __("Error: couldn't register new nickname in members only room"); this.createMessage({ message, 'type': 'error' }); + this.set({ 'nick': old_nick }); return; } }