Only register new nick if auto_register_muc_nickname is set
This commit is contained in:
parent
1c6ada4af8
commit
2fb8ea3ea0
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user