Override save on ChatBox to not persist the 'trimmed' attribute

This commit is contained in:
JC Brand 2014-05-13 11:50:33 +02:00
parent 0c0a3f86b6
commit 1a92db8946

View File

@ -662,6 +662,24 @@
}
},
save: function(key, val, options) {
/* Override the backbone function and exclude the 'trimmed'
* attribute from being persisted.
*/
var attrs;
// Handle both `"key", value` and `{key: value}` -style arguments.
if (key == null || typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
if (typeof attrs === 'object') {
delete attrs.trimmed;
}
Backbone.Model.prototype.save.call(this, attrs, options);
},
getSession: function (callback) {
var cipher = CryptoJS.lib.PasswordBasedCipher;
var result, pass, instance_tag, saved_key, pass_check;