-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 | |||
@@ -72,25 +72,26 @@ Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, { | |||
72 | return this._updatedSections; | 72 | return this._updatedSections; |
73 | }, | 73 | }, |
74 | 74 | ||
75 | 'markSectionAsUpdated': function(aSectionName) { | 75 | 'markSectionAsUpdated': function(aSectionName) { |
76 | this.updatedSections().push(aSectionName); | 76 | this.updatedSections().push(aSectionName); |
77 | }, | 77 | }, |
78 | 78 | ||
79 | 'resetUpdatedSections': function() { | 79 | 'resetUpdatedSections': function() { |
80 | this._updatedSections = [] | 80 | this._updatedSections = [] |
81 | }, | 81 | }, |
82 | 82 | ||
83 | 'hasSectionBeenUpdated': function(aSectionName) { | 83 | 'hasSectionBeenUpdated': function(aSectionName) { |
84 | return (this.updatedSections().join().indexOf(aSectionName) != -1); | 84 | return(this.updatedSections().join().indexOf(aSectionName) != -1) |
85 | ||(this.serverDataVersion() != Clipperz.PM.Crypto.encryptingFunctions.currentVersion); | ||
85 | }, | 86 | }, |
86 | 87 | ||
87 | 'cachedServerDataSection': function(aSectionName) { | 88 | 'cachedServerDataSection': function(aSectionName) { |
88 | return (this.hasSectionBeenUpdated(aSectionName)) ? {} : this.jsonEvaledServerData()[aSectionName]; | 89 | return (this.hasSectionBeenUpdated(aSectionName)) ? {} : this.jsonEvaledServerData()[aSectionName]; |
89 | }, | 90 | }, |
90 | 91 | ||
91 | 'updateAllSections': function() { | 92 | 'updateAllSections': function() { |
92 | this.resetUpdatedSections(); | 93 | this.resetUpdatedSections(); |
93 | this.markSectionAsUpdated('records'); | 94 | this.markSectionAsUpdated('records'); |
94 | this.markSectionAsUpdated('directLogins'); | 95 | this.markSectionAsUpdated('directLogins'); |
95 | this.markSectionAsUpdated('preferences'); | 96 | this.markSectionAsUpdated('preferences'); |
96 | this.markSectionAsUpdated('oneTimePasswords'); | 97 | this.markSectionAsUpdated('oneTimePasswords'); |
@@ -403,24 +404,25 @@ Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, { | |||
403 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | 404 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); |
404 | break; | 405 | break; |
405 | case '0.1': | 406 | case '0.1': |
406 | var data; | 407 | var data; |
407 | 408 | ||
408 | //# data = Clipperz.Base.evalJSON(this.serverData()); | 409 | //# data = Clipperz.Base.evalJSON(this.serverData()); |
409 | data = this.jsonEvaledServerData(); | 410 | data = this.jsonEvaledServerData(); |
410 | if (typeof(data[aKey]) != 'undefined') { | 411 | if (typeof(data[aKey]) != 'undefined') { |
411 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 4: "/* + res*/); return res;}); | 412 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 4: "/* + res*/); return res;}); |
412 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | 413 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); |
413 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_decryptingUserData'); | 414 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_decryptingUserData'); |
414 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 5: "/* + res*/); return res;}); | 415 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 5: "/* + res*/); return res;}); |
416 | //deferredResult.addBoth(function(res) {console.log("aKey: " + aKey); return res;}); | ||
415 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | 417 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); |
416 | deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, this.user().passphrase(), data[aKey]['data'], this.serverDataVersion()); | 418 | deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, this.user().passphrase(), data[aKey]['data'], this.serverDataVersion()); |
417 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 6: "/* + res*/); return res;}); | 419 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 6: "/* + res*/); return res;}); |
418 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | 420 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); |
419 | deferredResult.addCallback(function(/*anHeader,*/ aKey, aData, aRecordIndex, aValue) { | 421 | deferredResult.addCallback(function(/*anHeader,*/ aKey, aData, aRecordIndex, aValue) { |
420 | var result; | 422 | var result; |
421 | //MochiKit.Logging.logDebug(">>> [start] ==============================================="); | 423 | //MochiKit.Logging.logDebug(">>> [start] ==============================================="); |
422 | //MochiKit.Logging.logDebug("--- extractDataWithKey - 0 [" + aKey + "]: " + Clipperz.Base.serializeJSON(aValue)); | 424 | //MochiKit.Logging.logDebug("--- extractDataWithKey - 0 [" + aKey + "]: " + Clipperz.Base.serializeJSON(aValue)); |
423 | //MochiKit.Logging.logDebug("<<< [end] ================================================="); | 425 | //MochiKit.Logging.logDebug("<<< [end] ================================================="); |
424 | if (aKey == 'records') { | 426 | if (aKey == 'records') { |
425 | var recordKey; | 427 | var recordKey; |
426 | 428 | ||