Bugfix. Don't call Jed's translate method

before converse.initialize has been called. Otherwise we won't get
translations.

Updates #669
This commit is contained in:
JC Brand 2016-07-18 11:34:31 +00:00
parent 71381e2f22
commit 01e10a9b24

View File

@ -18,6 +18,39 @@
_ = converse_api.env._,
__ = utils.__.bind(converse);
converse_api.plugins.add('rosterview', {
overrides: {
// Overrides mentioned here will be picked up by converse.js's
// plugin architecture they will replace existing methods on the
// relevant objects or classes.
//
// New functions which don't exist yet can also be added.
afterReconnected: function () {
this.rosterview.registerRosterXHandler();
this._super.afterReconnected.apply(this, arguments);
},
RosterGroups: {
comparator: function () {
// RosterGroupsComparator only gets set later (once i18n is
// set up), so we need to wrap it in this nameless function.
return converse.RosterGroupsComparator.apply(this, arguments);
}
}
},
initialize: function () {
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
this.updateSettings({
allow_chat_pending_contacts: false,
allow_contact_removal: true,
show_toolbar: true,
});
var STATUSES = {
'dnd': __('This contact is busy'),
'online': __('This contact is online'),
@ -38,22 +71,7 @@
HEADER_WEIGHTS[HEADER_UNGROUPED] = 2;
HEADER_WEIGHTS[HEADER_PENDING_CONTACTS] = 3;
converse_api.plugins.add('rosterview', {
overrides: {
// Overrides mentioned here will be picked up by converse.js's
// plugin architecture they will replace existing methods on the
// relevant objects or classes.
//
// New functions which don't exist yet can also be added.
afterReconnected: function () {
this.rosterview.registerRosterXHandler();
this._super.afterReconnected.apply(this, arguments);
},
RosterGroups: {
comparator: function (a, b) {
converse.RosterGroupsComparator = function (a, b) {
/* Groups are sorted alphabetically, ignoring case.
* However, Ungrouped, Requesting Contacts and Pending Contacts
* appear last and in that order.
@ -72,21 +90,9 @@
} else if (a_is_special && !b_is_special) {
return (a === HEADER_REQUESTING_CONTACTS) ? -1 : 1;
}
}
}
},
};
initialize: function () {
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
this.updateSettings({
allow_chat_pending_contacts: false,
allow_contact_removal: true,
show_toolbar: true,
});
converse.RosterFilter = Backbone.Model.extend({
initialize: function () {
this.set({