Commit be1be353 authored by JC Brand's avatar JC Brand

Don't render the lock icon when the MUC doesn't qualify

Updates #1180
parent 9aca32ad
......@@ -56406,6 +56406,18 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
this.model.save({
'omemo_active': !this.model.get('omemo_active')
});
},
renderOMEMOToolbarButton() {
if (this.model.get('membersonly') && this.model.get('nonanonymous')) {
this.__super__.renderOMEMOToolbarButton.apply(arguments);
} else {
const icon = this.el.querySelector('.toggle-omemo');
if (icon) {
icon.parentElement.removeChild(icon);
}
}
}
}
......@@ -57194,7 +57206,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
}
async function onOccupantAdded(chatroom, occupant) {
if (occupant.isSelf() || !chatroom.get('nonanonymous')) {
if (occupant.isSelf() || !chatroom.get('nonanonymous') || !chatroom.get('membersonly')) {
return;
}
......@@ -1255,10 +1255,7 @@
view.model.save({'nonanonymous': false, 'semianonymous': true});
await test_utils.waitUntil(() => !view.model.get('omemo_supported'));
toggle = toolbar.querySelector('.toggle-omemo');
expect(_.isNull(toggle)).toBe(false);
expect(u.hasClass('fa-unlock', toggle)).toBe(true);
expect(u.hasClass('fa-lock', toggle)).toBe(false);
expect(u.hasClass('disabled', toggle)).toBe(true);
expect(_.isNull(toggle)).toBe(true);
expect(view.model.get('omemo_supported')).toBe(false);
view.model.save({'nonanonymous': true, 'semianonymous': false});
......@@ -1273,11 +1270,7 @@
view.model.save({'membersonly': false, 'open': true});
await test_utils.waitUntil(() => !view.model.get('omemo_supported'));
toggle = toolbar.querySelector('.toggle-omemo');
expect(_.isNull(toggle)).toBe(false);
expect(u.hasClass('fa-unlock', toggle)).toBe(true);
expect(u.hasClass('fa-lock', toggle)).toBe(false);
expect(u.hasClass('disabled', toggle)).toBe(true);
expect(view.model.get('omemo_supported')).toBe(false);
expect(_.isNull(toggle)).toBe(true);
view.model.save({'membersonly': true, 'open': false});
await test_utils.waitUntil(() => view.model.get('omemo_supported'));
......
......@@ -443,6 +443,17 @@ converse.plugins.add('converse-omemo', {
}
ev.preventDefault();
this.model.save({'omemo_active': !this.model.get('omemo_active')});
},
renderOMEMOToolbarButton () {
if (this.model.get('membersonly') && this.model.get('nonanonymous')) {
this.__super__.renderOMEMOToolbarButton.apply(arguments);
} else {
const icon = this.el.querySelector('.toggle-omemo');
if (icon) {
icon.parentElement.removeChild(icon);
}
}
}
}
},
......@@ -1121,7 +1132,7 @@ converse.plugins.add('converse-omemo', {
}
async function onOccupantAdded (chatroom, occupant) {
if (occupant.isSelf() || !chatroom.get('nonanonymous')) {
if (occupant.isSelf() || !chatroom.get('nonanonymous') || !chatroom.get('membersonly')) {
return;
}
if (chatroom.get('omemo_active')) {
......
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