Commit e9872145 authored by JC Brand's avatar JC Brand

For roomspanel, don't set `muc_domain` if its locked

parent 50d9b2ec
# Changelog
## 4.2.1 (Unreaded)
* Bugfix. Don't set `muc_domain` for roomspanel if `locked_muc_domain` is `true`.
## 4.2.0 (2019-04-04)
**Note:** This release introduces a hard requirement on [MAM:2](https://xmpp.org/extensions/xep-0313.html),
......
......@@ -269,7 +269,7 @@ converse.plugins.add('converse-muc-views', {
'submit form': 'showRooms',
'click a.room-info': 'toggleRoomInfo',
'change input[name=nick]': 'setNick',
'change input[name=server]': 'setDomain',
'change input[name=server]': 'setDomainFromEvent',
'click .open-room': 'openRoom'
},
......@@ -383,12 +383,12 @@ converse.plugins.add('converse-muc-views', {
showRooms (ev) {
ev.preventDefault();
const data = new FormData(ev.target);
this.model.save('muc_domain', Strophe.getDomainFromJid(data.get('server')));
this.model.setDomain(data.get('server'));
this.updateRoomsList();
},
setDomain (ev) {
this.model.save('muc_domain', Strophe.getDomainFromJid(ev.target.value));
setDomainFromEvent (ev) {
this.model.setDomain(ev.target.value);
},
setNick (ev) {
......@@ -431,7 +431,6 @@ converse.plugins.add('converse-muc-views', {
parseRoomDataFromEvent (form) {
const data = new FormData(form);
const jid = data.get('chatroom');
this.model.save('muc_domain', Strophe.getDomainFromJid(jid));
let nick;
if (_converse.locked_muc_nickname) {
nick = _converse.getDefaultMUCNickname();
......@@ -459,6 +458,7 @@ converse.plugins.add('converse-muc-views', {
jid = `${Strophe.escapeNode(data.jid)}@${_converse.muc_domain}`;
} else {
jid = data.jid
this.model.setDomain(jid);
}
_converse.api.rooms.open(jid, _.extend(data, {jid}));
this.modal.hide();
......@@ -2040,7 +2040,6 @@ converse.plugins.add('converse-muc-views', {
function setMUCDomain (domain, controlboxview) {
_converse.muc_domain = domain;
controlboxview.roomspanel.model.save('muc_domain', Strophe.getDomainFromJid(domain));
}
......
......@@ -1308,9 +1308,15 @@ converse.plugins.add('converse-muc', {
_converse.RoomsPanelModel = Backbone.Model.extend({
defaults: function () {
return {
'muc_domain': '',
'muc_domain': _converse.muc_domain,
'nick': _converse.getDefaultMUCNickname()
}
},
setDomain (jid) {
if (!_converse.locked_muc_domain) {
this.save('muc_domain', Strophe.getDomainFromJid(jid));
}
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment