浏览代码

gui: Add arrays for pending/ignored folders (fixes #5190) (#5192)

Audrius Butkevicius 7 年之前
父节点
当前提交
710dba7f84
共有 2 个文件被更改,包括 23 次插入1 次删除
  1. 3 1
      gui/default/syncthing/core/syncthingController.js
  2. 20 0
      lib/config/config_test.go

+ 3 - 1
gui/default/syncthing/core/syncthingController.js

@@ -1388,7 +1388,9 @@ angular.module('syncthing.core')
                         _addressesStr: 'dynamic',
                         compression: 'metadata',
                         introducer: false,
-                        selectedFolders: {}
+                        selectedFolders: {},
+                        pendingFolders: [],
+                        ignoredFolders: []
                     };
                     $scope.editingExisting = false;
                     $scope.deviceEditor.$setPristine();

+ 20 - 0
lib/config/config_test.go

@@ -1073,6 +1073,26 @@ func TestFilterURLSchemePrefix(t *testing.T) {
 	}
 }
 
+func TestDeviceConfigObservedNotNil(t *testing.T) {
+	cfg := Configuration{
+		Devices: []DeviceConfiguration{
+			{},
+		},
+	}
+
+	cfg.prepare(device1)
+
+	for _, dev := range cfg.Devices {
+		if dev.IgnoredFolders == nil {
+			t.Errorf("Ignored folders nil")
+		}
+
+		if dev.PendingFolders == nil {
+			t.Errorf("Pending folders nil")
+		}
+	}
+}
+
 // defaultConfigAsMap returns a valid default config as a JSON-decoded
 // map[string]interface{}. This is useful to override random elements and
 // re-encode into JSON.