fix(gui): don't fetch usage report preview unnecessarily on GUI load (#10395)

IMHO the logic here was inverted. The only use for the report data is to
show a preview when we ask the user whether they want to participate in
usage reporting. However, the GUI would first load the report data and
then consider whether we wanted to show that dialog or not. Instead,
only load if it we're going to show the dialog.

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2025-09-16 16:01:17 +00:00
committed by GitHub
parent ea19ec64bf
commit 5595113074

View File

@@ -187,13 +187,14 @@ angular.module('syncthing.core')
$scope.version = data;
}).error($scope.emitHTTPError);
$http.get(urlbase + '/svc/report').success(function (data) {
$scope.reportData = data;
if ($scope.system && $scope.config.options.urAccepted > -1 && $scope.config.options.urSeen < $scope.system.urVersionMax && $scope.config.options.urAccepted < $scope.system.urVersionMax) {
// Usage reporting format has changed, prompt the user to re-accept.
if ($scope.system && $scope.config.options.urAccepted > -1 && $scope.config.options.urSeen < $scope.system.urVersionMax && $scope.config.options.urAccepted < $scope.system.urVersionMax) {
// Usage reporting decision has not been taken or format
// has changed, prompt the user to (re-)accept.
$http.get(urlbase + '/svc/report').success(function (data) {
$scope.reportData = data;
showModal('#ur');
}
}).error($scope.emitHTTPError);
}).error($scope.emitHTTPError);
}
$http.get(urlbase + '/system/upgrade').success(function (data) {
$scope.upgradeInfo = data;