Merge branch '0.6.x'

Conflicts:
	converse.js
	index.html

Add config option ``allow_contact_requests`` to toggle user adding
This commit is contained in:
JC Brand 2013-10-03 14:25:39 +02:00
commit b8e096ffd1
3 changed files with 18 additions and 6 deletions

View File

@ -8,7 +8,8 @@ Changelog
* Hungarian translation [w3host] * Hungarian translation [w3host]
* Russian translation [bkocherov] * Russian translation [bkocherov]
* Update CSS to avoid clash with bootstrap [seocam] * Update CSS to avoid clash with bootstrap [seocam]
* Add config option ``allow_muc`` to enable/disable multi-user chat (MUC) [jcbrand] * Add config option ``allow_muc`` to toggle multi-user chat (MUC) [jcbrand]
* Add config option ``allow_contact_requests`` to toggle user adding [jcbrand]
0.6.4 (2013-09-15) 0.6.4 (2013-09-15)
------------------ ------------------

View File

@ -55,6 +55,7 @@
}; };
// Default values // Default values
this.allow_contact_requests = true;
this.allow_muc = true; this.allow_muc = true;
this.allow_otr = true; this.allow_otr = true;
this.animate = true; this.animate = true;
@ -76,6 +77,7 @@
// Allow only the whitelisted settings attributes to be overwritten, // Allow only the whitelisted settings attributes to be overwritten,
// nothing else. // nothing else.
whitelist = [ whitelist = [
'allow_contact_requests',
'allow_muc', 'allow_muc',
'allow_otr', 'allow_otr',
'animate', 'animate',
@ -1064,7 +1066,10 @@
'<option value="offline">'+__('Offline')+'</option>'+ '<option value="offline">'+__('Offline')+'</option>'+
'</select>'+ '</select>'+
'</span>'+ '</span>'+
'</form>'+ '</form>'
),
add_contact_dropdown_template: _.template(
'<dl class="add-converse-contact dropdown">' + '<dl class="add-converse-contact dropdown">' +
'<dt id="xmpp-contact-search" class="fancy-dropdown">' + '<dt id="xmpp-contact-search" class="fancy-dropdown">' +
'<a class="toggle-xmpp-contact-form" href="#"'+ '<a class="toggle-xmpp-contact-form" href="#"'+
@ -1075,7 +1080,7 @@
'</dl>' '</dl>'
), ),
add_contact_template: _.template( add_contact_form_template: _.template(
'<li>'+ '<li>'+
'<form class="add-xmpp-contact">' + '<form class="add-xmpp-contact">' +
'<input type="text" name="identifier" class="username" placeholder="'+__('Contact username')+'"/>' + '<input type="text" name="identifier" class="username" placeholder="'+__('Contact username')+'"/>' +
@ -1100,13 +1105,20 @@
render: function () { render: function () {
var markup; var markup;
var widgets = this.template();
this.$tabs.append(this.tab_template()); this.$tabs.append(this.tab_template());
if (converse.xhr_user_search) { if (converse.xhr_user_search) {
markup = this.search_contact_template(); markup = this.search_contact_template();
} else { } else {
markup = this.add_contact_template(); markup = this.add_contact_form_template();
} }
this.$el.html(this.template());
if (converse.allow_contact_requests) {
widgets += this.add_contact_dropdown_template();
}
this.$el.html(widgets);
this.$el.find('.search-xmpp ul').append(markup); this.$el.find('.search-xmpp ul').append(markup);
this.$el.append(converse.rosterview.$el); this.$el.append(converse.rosterview.$el);
return this; return this;

View File

@ -195,7 +195,6 @@
require(['converse'], function (converse) { require(['converse'], function (converse) {
converse.initialize({ converse.initialize({
allow_otr: true, allow_otr: true,
allow_muc: true,
auto_list_rooms: false, auto_list_rooms: false,
auto_subscribe: false, auto_subscribe: false,
bosh_service_url: 'https://bind.opkode.im', // Please use this connection manager only for testing purposes bosh_service_url: 'https://bind.opkode.im', // Please use this connection manager only for testing purposes