gui: Fix loading default ignores (#8135)

This commit is contained in:
Simon Frei 2022-01-21 17:24:11 +01:00 committed by GitHub
parent e40289ce7a
commit f0d5dc5696
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2090,7 +2090,12 @@ angular.module('syncthing.core')
function editFolderLoadIgnores() { function editFolderLoadIgnores() {
editFolderLoadingIgnores(); editFolderLoadingIgnores();
return editFolderGetIgnores().then(editFolderInitIgnores, $scope.emitHTTPError); return editFolderGetIgnores().then(function(data) {
if (!data) {
return;
}
editFolderInitIgnores(data.ignore, data.error);
}, $scope.emitHTTPError);
} }
$scope.editFolderDefaults = function() { $scope.editFolderDefaults = function() {
@ -2109,10 +2114,10 @@ angular.module('syncthing.core')
}); });
} }
function editFolderInitIgnores(data) { function editFolderInitIgnores(lines, error) {
$scope.ignores.originalLines = data.ignore || []; $scope.ignores.originalLines = lines || [];
setIgnoresText(data.ignore); setIgnoresText(lines);
$scope.ignores.error = data.error; $scope.ignores.error = error;
$scope.ignores.disabled = false; $scope.ignores.disabled = false;
} }
@ -2288,7 +2293,7 @@ angular.module('syncthing.core')
return; return;
} }
if ((data.ignore && data.ignore.length > 0) || data.error) { if ((data.ignore && data.ignore.length > 0) || data.error) {
editFolderInitIgnores(data); editFolderInitIgnores(data.ignore, data.error);
} else { } else {
getDefaultIgnores().then(function(lines) { getDefaultIgnores().then(function(lines) {
setIgnoresText(lines); setIgnoresText(lines);