-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/Header.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Header.js b/frontend/beta/js/Clipperz/PM/DataModel/Header.js index 908d9f4..d577830 100644 --- a/frontend/beta/js/Clipperz/PM/DataModel/Header.js +++ b/frontend/beta/js/Clipperz/PM/DataModel/Header.js @@ -68,33 +68,34 @@ Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, { //------------------------------------------------------------------------- //------------------------------------------------------------------------- 'updatedSections': function() { return this._updatedSections; }, 'markSectionAsUpdated': function(aSectionName) { this.updatedSections().push(aSectionName); }, 'resetUpdatedSections': function() { this._updatedSections = [] }, 'hasSectionBeenUpdated': function(aSectionName) { - return (this.updatedSections().join().indexOf(aSectionName) != -1); + return (this.updatedSections().join().indexOf(aSectionName) != -1) + || (this.serverDataVersion() != Clipperz.PM.Crypto.encryptingFunctions.currentVersion); }, 'cachedServerDataSection': function(aSectionName) { return (this.hasSectionBeenUpdated(aSectionName)) ? {} : this.jsonEvaledServerData()[aSectionName]; }, 'updateAllSections': function() { this.resetUpdatedSections(); this.markSectionAsUpdated('records'); this.markSectionAsUpdated('directLogins'); this.markSectionAsUpdated('preferences'); this.markSectionAsUpdated('oneTimePasswords'); return MochiKit.Async.succeed(this); }, @@ -399,32 +400,33 @@ Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, { deferredResult.addCallback(function(someDecryptedValues) { return someDecryptedValues[aKey] || {}; }) //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 3: "/* + res*/); return res;}); //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); break; case '0.1': var data; //# data = Clipperz.Base.evalJSON(this.serverData()); data = this.jsonEvaledServerData(); if (typeof(data[aKey]) != 'undefined') { //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 4: "/* + res*/); return res;}); //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_decryptingUserData'); //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 5: "/* + res*/); return res;}); +//deferredResult.addBoth(function(res) {console.log("aKey: " + aKey); return res;}); //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, this.user().passphrase(), data[aKey]['data'], this.serverDataVersion()); //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 6: "/* + res*/); return res;}); //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); deferredResult.addCallback(function(/*anHeader,*/ aKey, aData, aRecordIndex, aValue) { var result; //MochiKit.Logging.logDebug(">>> [start] ==============================================="); //MochiKit.Logging.logDebug("--- extractDataWithKey - 0 [" + aKey + "]: " + Clipperz.Base.serializeJSON(aValue)); //MochiKit.Logging.logDebug("<<< [end] ================================================="); if (aKey == 'records') { var recordKey; result = {}; for (recordKey in aData['index']) { result[recordKey] = aValue[aData['index'][recordKey]]; } |