Call rebindCallback on errors as well (#9690)

(cherry picked from commit da0c82aabd)
This commit is contained in:
Niels Lyngsø
2021-01-20 14:26:40 +01:00
committed by Sebastiaan Janssen
parent bc8f8366c2
commit 52e8da2ff2

View File

@@ -461,7 +461,7 @@
syncTreeNode($scope.content, data.path, false, args.reloadChildren);
eventsService.emit("content.saved", { content: $scope.content, action: args.action });
eventsService.emit("content.saved", { content: $scope.content, action: args.action, valid: true });
resetNestedFieldValiation(fieldsToRollback);
ensureDirtyIsSetIfAnyVariantIsDirty();
@@ -470,11 +470,14 @@
},
function (err) {
//needs to be manually set for infinite editing mode
$scope.page.isNew = false;
syncTreeNode($scope.content, $scope.content.path);
if (err.status === 400 && err.data) {
// content was saved but is invalid.
eventsService.emit("content.saved", { content: $scope.content, action: args.action, valid: false });
}
resetNestedFieldValiation(fieldsToRollback);
return $q.reject(err);