Commit 7a330600 authored by JC Brand's avatar JC Brand

Fixes #1214

Hide "add contact" button and requesting/pending contacts when
allow_contact_requests is false.
parent ad142028
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
- Bugfix. Handler not triggered when submitting MUC password form 2nd time - Bugfix. Handler not triggered when submitting MUC password form 2nd time
- Bugfix. MUC features weren't being refreshed when saving the config form - Bugfix. MUC features weren't being refreshed when saving the config form
- #1214 Setting `allow_contact_requests` to `false` has no effect
- #1222 Adding a bookmark should prefill the room name - #1222 Adding a bookmark should prefill the room name
## 4.0.2 (2018-10-02) ## 4.0.2 (2018-10-02)
......
...@@ -77129,6 +77129,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -77129,6 +77129,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
render() { render() {
this.el.innerHTML = tpl_roster({ this.el.innerHTML = tpl_roster({
'allow_contact_requests': _converse.allow_contact_requests,
'heading_contacts': __('Contacts'), 'heading_contacts': __('Contacts'),
'title_add_contact': __('Add a contact') 'title_add_contact': __('Add a contact')
}); });
...@@ -77305,6 +77306,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -77305,6 +77306,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
if (contact.get('subscription') === 'both' || contact.get('subscription') === 'to') { if (contact.get('subscription') === 'both' || contact.get('subscription') === 'to') {
this.addExistingContact(contact, options); this.addExistingContact(contact, options);
} else { } else {
if (!_converse.allow_contact_requests) {
_converse.log(`Not adding requesting or pending contact ${contact.get('jid')} ` + `because allow_contact_requests is false`, Strophe.LogLevel.DEBUG);
return;
}
if (contact.get('ask') === 'subscribe' || contact.get('subscription') === 'from') { if (contact.get('ask') === 'subscribe' || contact.get('subscription') === 'from') {
this.addContactToGroup(contact, HEADER_PENDING_CONTACTS, options); this.addContactToGroup(contact, HEADER_PENDING_CONTACTS, options);
} else if (contact.get('requesting') === true) { } else if (contact.get('requesting') === true) {
...@@ -80065,7 +80072,7 @@ var __t, __p = '', __e = _.escape, __j = Array.prototype.join; ...@@ -80065,7 +80072,7 @@ var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') } function print() { __p += __j.call(arguments, '') }
__p += '<!-- src/templates/pending_contact.html -->\n'; __p += '<!-- src/templates/pending_contact.html -->\n';
if (o.allow_chat_pending_contacts) { ; if (o.allow_chat_pending_contacts) { ;
__p += '\n<a class="open-chat w-100" href="#">\n'; __p += '<a class="open-chat w-100" href="#">';
} ; } ;
__p += '\n<span class="pending-contact-name w-100" title="JID: ' + __p += '\n<span class="pending-contact-name w-100" title="JID: ' +
__e(o.jid) + __e(o.jid) +
...@@ -80073,7 +80080,7 @@ __e(o.jid) + ...@@ -80073,7 +80080,7 @@ __e(o.jid) +
__e(o.display_name) + __e(o.display_name) +
'</span> \n'; '</span> \n';
if (o.allow_chat_pending_contacts) { ; if (o.allow_chat_pending_contacts) { ;
__p += '</a>\n'; __p += '</a>';
} ; } ;
__p += '\n<a class="remove-xmpp-contact far fa-trash-alt" title="' + __p += '\n<a class="remove-xmpp-contact far fa-trash-alt" title="' +
__e(o.desc_remove) + __e(o.desc_remove) +
...@@ -80694,12 +80701,17 @@ return __p ...@@ -80694,12 +80701,17 @@ return __p
var _ = {escape:__webpack_require__(/*! ./node_modules/lodash/escape.js */ "./node_modules/lodash/escape.js")}; var _ = {escape:__webpack_require__(/*! ./node_modules/lodash/escape.js */ "./node_modules/lodash/escape.js")};
module.exports = function(o) { module.exports = function(o) {
var __t, __p = '', __e = _.escape; var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
__p += '<!-- src/templates/roster.html -->\n<div class="d-flex controlbox-padded">\n <span class="w-100 controlbox-heading">' + __p += '<!-- src/templates/roster.html -->\n<div class="d-flex controlbox-padded">\n <span class="w-100 controlbox-heading">' +
__e(o.heading_contacts) + __e(o.heading_contacts) +
'</span>\n <a class="chatbox-btn add-contact fa fa-user-plus" title="' + '</span>\n ';
if (o.allow_contact_requests) { ;
__p += '\n <a class="chatbox-btn add-contact fa fa-user-plus"\n title="' +
__e(o.title_add_contact) + __e(o.title_add_contact) +
'"\n data-toggle="modal" data-target="#add-contact-modal"></a>\n</div>\n\n<form class="roster-filter-form"></form>\n\n<div class="roster-contacts"></div>\n'; '"\n data-toggle="modal"\n data-target="#add-contact-modal"></a>\n ';
} ;
__p += '\n</div>\n\n<form class="roster-filter-form"></form>\n\n<div class="roster-contacts"></div>\n';
return __p return __p
}; };
...@@ -800,6 +800,7 @@ ...@@ -800,6 +800,7 @@
render () { render () {
this.el.innerHTML = tpl_roster({ this.el.innerHTML = tpl_roster({
'allow_contact_requests': _converse.allow_contact_requests,
'heading_contacts': __('Contacts'), 'heading_contacts': __('Contacts'),
'title_add_contact': __('Add a contact') 'title_add_contact': __('Add a contact')
}); });
...@@ -952,6 +953,14 @@ ...@@ -952,6 +953,14 @@
if (contact.get('subscription') === 'both' || contact.get('subscription') === 'to') { if (contact.get('subscription') === 'both' || contact.get('subscription') === 'to') {
this.addExistingContact(contact, options); this.addExistingContact(contact, options);
} else { } else {
if (!_converse.allow_contact_requests) {
_converse.log(
`Not adding requesting or pending contact ${contact.get('jid')} `+
`because allow_contact_requests is false`,
Strophe.LogLevel.DEBUG
);
return;
}
if ((contact.get('ask') === 'subscribe') || (contact.get('subscription') === 'from')) { if ((contact.get('ask') === 'subscribe') || (contact.get('subscription') === 'from')) {
this.addContactToGroup(contact, HEADER_PENDING_CONTACTS, options); this.addContactToGroup(contact, HEADER_PENDING_CONTACTS, options);
} else if (contact.get('requesting') === true) { } else if (contact.get('requesting') === true) {
......
{[ if (o.allow_chat_pending_contacts) { ]} {[ if (o.allow_chat_pending_contacts) { ]}<a class="open-chat w-100" href="#">{[ } ]}
<a class="open-chat w-100" href="#">
{[ } ]}
<span class="pending-contact-name w-100" title="JID: {{{o.jid}}}">{{{o.display_name}}}</span> <span class="pending-contact-name w-100" title="JID: {{{o.jid}}}">{{{o.display_name}}}</span>
{[ if (o.allow_chat_pending_contacts) { ]}</a> {[ if (o.allow_chat_pending_contacts) { ]}</a>{[ } ]}
{[ } ]}
<a class="remove-xmpp-contact far fa-trash-alt" title="{{{o.desc_remove}}}" href="#"></a> <a class="remove-xmpp-contact far fa-trash-alt" title="{{{o.desc_remove}}}" href="#"></a>
<div class="d-flex controlbox-padded"> <div class="d-flex controlbox-padded">
<span class="w-100 controlbox-heading">{{{o.heading_contacts}}}</span> <span class="w-100 controlbox-heading">{{{o.heading_contacts}}}</span>
<a class="chatbox-btn add-contact fa fa-user-plus" title="{{{o.title_add_contact}}}" {[ if (o.allow_contact_requests) { ]}
data-toggle="modal" data-target="#add-contact-modal"></a> <a class="chatbox-btn add-contact fa fa-user-plus"
title="{{{o.title_add_contact}}}"
data-toggle="modal"
data-target="#add-contact-modal"></a>
{[ } ]}
</div> </div>
<form class="roster-filter-form"></form> <form class="roster-filter-form"></form>
......
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