Fix client updated at, message when importing
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user