From 1a92db89466d0b62d6d31dab01d350ce2344574c Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 13 May 2014 11:50:33 +0200 Subject: [PATCH] Override save on ChatBox to not persist the 'trimmed' attribute --- converse.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/converse.js b/converse.js index f75308328..1e1bfd40c 100644 --- a/converse.js +++ b/converse.js @@ -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;