Fix client updated at, message when importing

This commit is contained in:
Mo Bitar
2018-06-08 10:12:04 -05:00
parent 0fd9a79559
commit be7a4b7b9f
5 changed files with 20 additions and 7 deletions

View File

@@ -246,9 +246,9 @@ class AccountMenu {
var onDataReady = function(errorCount) {
var items = modelManager.mapResponseItemsToLocalModels(data.items, ModelManager.MappingSourceFileImport);
items.forEach(function(item){
item.setDirty(true);
item.setDirty(true, true);
item.deleted = false;
item.markAllReferencesDirty();
item.markAllReferencesDirty(true);
// We don't want to activate any components during import process in case of exceptions
// breaking up the import proccess

View File

@@ -87,6 +87,9 @@ class Item {
if(dirty && !dontUpdateClientDate) {
// Set the client modified date to now if marking the item as dirty
this.client_updated_at = new Date();
} else if(!this.hasRawClientUpdatedAtValue()) {
// copy updated_at
this.client_updated_at = new Date(this.updated_at);
}
if(dirty) {
@@ -94,9 +97,9 @@ class Item {
}
}
markAllReferencesDirty() {
markAllReferencesDirty(dontUpdateClientDate) {
this.allReferencedObjects().forEach(function(reference){
reference.setDirty(true);
reference.setDirty(true, dontUpdateClientDate);
})
}
@@ -222,6 +225,10 @@ class Item {
return this.getAppDataItem("locked");
}
hasRawClientUpdatedAtValue() {
return this.getAppDataItem("client_updated_at") != null;
}
get client_updated_at() {
if(!this._client_updated_at) {
var saved = this.getAppDataItem("client_updated_at");

View File

@@ -411,7 +411,7 @@ class SyncManager {
) {
this.$rootScope.$broadcast("major-data-change");
}
this.callQueuedCallbacksAndCurrent(callback, response);
this.$rootScope.$broadcast("sync:completed", {retrievedItems: this.allRetreivedItems, savedItems: this.allSavedItems});

View File

@@ -158,6 +158,9 @@
.button-group.stretch.panel-row.form-submit
%button.button.info{"type" => "submit"}
.label Decrypt & Import
%p
Importing from backup will overwrite existing notes with matching note from backup. Existing notes not found in the backup will remain as-is and won't be overwritten.
%p If you'd like to import only a selection of notes instead of the whole file, please use the Batch Manager extension instead.
.panel-row
.spinner.small.info{"ng-if" => "importData.loading"}
.footer

View File

@@ -57,6 +57,9 @@
%li Desktop
%li Web (Chrome, Firefox, Safari)
%li Mobile (iOS and Android)
%p.panel-row
If you do not currently have access to a device you're signed in on, you may proceed,
but must make signing out and back in the first step upon gaining access to that device.
%p.panel-row Press Continue only when you have completed signing out of all your devices.
@@ -84,8 +87,8 @@
.spinner.small.inline.info.mr-5{"ng-if" => "formData.processing"}
.inline.bold{"ng-class" => "{'info' : !formData.statusError, 'error' : formData.statusError}"}
{{formData.status}}
.panel-column
%p.info{"ng-if" => "syncStatus.total > 0"}
.panel-column{"delay-hide" => "true", "show" => "syncStatus.syncOpInProgress || syncStatus.needsMoreSync", "delay" => "1000"}
%p.info
Syncing {{syncStatus.current}}/{{syncStatus.total}}
%div{"ng-if" => "step == 5"}