From b16cc72fc7b36b7e7ea26aebf7e2c9d81a48cf1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Colomb?= Date: Fri, 27 Nov 2020 11:48:48 +0100 Subject: [PATCH] gui: Restore Select / Deselect All buttons in device sharing tab. (#7161) This fixes a regression by restoring two functions removed in commit a20d85d451fcce63d94b6d8c40de65d4db3c7bd9, but still used from the HTML template. Adjust the restored versions to access the new flag storage structure. The replacement functions selectAllSharedFolders() and selectAllUnrelatedFolders() are not functional, so this is just a quick fix to restore a working state before making the new functions actually work sensibly. Just like the respective functions for sharing device selections, give it a boolean argument instead of writing two almost identical functions. In line with the other selectAll...() functions, avoid calling angular.forEach() and iterate over the folders object directly. --- gui/default/syncthing/core/syncthingController.js | 7 +++++++ gui/default/syncthing/device/editDeviceModalView.html | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 1238e0e4c..9fd2194eb 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -1416,6 +1416,13 @@ angular.module('syncthing.core') $('#editDevice').modal(); }; + $scope.selectAllFolders = function (state) { + var folders = $scope.folders; + for (var id in folders) { + $scope.currentSharing.selected[id] = !!state; + }; + }; + $scope.selectAllSharedFolders = function (state) { var devices = $scope.currentSharing.shared; for (var i = 0; i < devices.length; i++) { diff --git a/gui/default/syncthing/device/editDeviceModalView.html b/gui/default/syncthing/device/editDeviceModalView.html index 49fd7d613..2f846f33b 100644 --- a/gui/default/syncthing/device/editDeviceModalView.html +++ b/gui/default/syncthing/device/editDeviceModalView.html @@ -69,8 +69,8 @@

Select the folders to share with this device.  - Select All  - Deselect All + Select All  + Deselect All