For roomspanel, don't set muc_domain if its locked

This commit is contained in:
JC Brand 2019-04-05 12:49:24 +02:00
parent 50d9b2ec80
commit e987214555
3 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,9 @@
# 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),

View File

@ -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));
}

View File

@ -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));
}
}
});