Don't render OMEMO stuff in profile modal if OMEMO's not enabled

This commit is contained in:
JC Brand 2018-08-21 17:52:36 +02:00
parent a06d2c494a
commit 3ec426e11d
5 changed files with 11 additions and 6 deletions

View File

@ -91,7 +91,7 @@
.c('device', {'id': '555'});
_converse.connection._dataRecv(test_utils.createRequest(stanza));
const devicelist = _converse.devicelists.create({'jid': contact_jid});
const devicelist = _converse.devicelists.get({'jid': contact_jid});
expect(devicelist.devices.length).toBe(1);
view = _converse.chatboxviews.get(contact_jid);

View File

@ -13,7 +13,7 @@
], factory);
}(this, function (converse, tpl_toolbar_omemo) {
const { Backbone, Promise, Strophe, moment, sizzle, $iq, $msg, _, b64_sha1 } = converse.env;
const { Backbone, Promise, Strophe, moment, sizzle, $iq, $msg, _, f, b64_sha1 } = converse.env;
const u = converse.env.utils;
Strophe.addNamespace('OMEMO', "eu.siacs.conversations.axolotl");
@ -63,7 +63,7 @@
converse.plugins.add('converse-omemo', {
enabled (_converse) {
return !_.isNil(window.libsignal);
return !_.isNil(window.libsignal) && !f.includes('converse-omemo', _converse.blacklisted_plugins);
},
dependencies: ["converse-chatview"],
@ -90,6 +90,9 @@
device_id = _converse.omemo_store.get('device_id').toString();
this.current_device = this.devicelist.devices.get(device_id);
this.other_devices = this.devicelist.devices.filter(d => (d.get('id') !== device_id));
if (this.__super__.beforeRender) {
return this.__super__.beforeRender.apply(this, arguments);
}
},
selectAll (ev) {

View File

@ -52,8 +52,8 @@
},
initialize () {
_converse.BootstrapModal.prototype.initialize.apply(this, arguments);
this.model.on('change', this.render, this);
_converse.BootstrapModal.prototype.initialize.apply(this, arguments);
_converse.emit('profileModalInitialized', this.model);
},

View File

@ -6,6 +6,7 @@
<button type="button" class="close" data-dismiss="modal" aria-label="{{{o.label_close}}}"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
{[ if (o._converse.pluggable.plugins['converse-omemo'].enabled(o._converse)) { ]}
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="profile-tab" href="#profile-tabpanel" aria-controls="profile-tabpanel" role="tab" data-toggle="tab">Profile</a>
@ -14,6 +15,7 @@
<a class="nav-link" id="omemo-tab" href="#omemo-tabpanel" aria-controls="omemo-tabpanel" role="tab" data-toggle="tab">OMEMO</a>
</li>
</ul>
{[ } ]}
<div class="tab-content">
<div class="tab-pane fade show active" id="profile-tabpanel" role="tabpanel" aria-labelledby="profile-tab">
<form class="converse-form converse-form--modal profile-form" action="#">
@ -63,7 +65,7 @@
</div>
</form>
</div>
{[ if (o._converse.pluggable.plugins['converse-omemo'].enabled()) { ]}
{[ if (o._converse.pluggable.plugins['converse-omemo'].enabled(o._converse)) { ]}
<div class="tab-pane fade" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">
<form class="converse-form fingerprint-removal">
<ul class="list-group fingerprints">

View File

@ -28,7 +28,7 @@
<p><label>{{{o.__('Role')}}}:</label>&nbsp;{{{o.role}}}</p>
{[ } ]}
{[ if (o._converse.pluggable.plugins['converse-omemo'].enabled()) { ]}
{[ if (o._converse.pluggable.plugins['converse-omemo'].enabled(o._converse)) { ]}
<hr>
<ul class="list-group fingerprints">
<li class="list-group-item active">{{{o.__('OMEMO Fingerprints')}}}</li>