gui, lib/config, lib/model: Add ability to ignore folders offered by other nodes (fixes #3993)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4179 LGTM: AudriusButkevicius, calmh
This commit is contained in:
@@ -155,6 +155,7 @@ type Configuration struct {
|
||||
GUI GUIConfiguration `xml:"gui" json:"gui"`
|
||||
Options OptionsConfiguration `xml:"options" json:"options"`
|
||||
IgnoredDevices []protocol.DeviceID `xml:"ignoredDevice" json:"ignoredDevices"`
|
||||
IgnoredFolders []string `xml:"ignoredFolder" json:"ignoredFolders"`
|
||||
XMLName xml.Name `xml:"configuration" json:"-"`
|
||||
|
||||
MyID protocol.DeviceID `xml:"-" json:"-"` // Provided by the instantiator.
|
||||
@@ -182,6 +183,10 @@ func (cfg Configuration) Copy() Configuration {
|
||||
newCfg.IgnoredDevices = make([]protocol.DeviceID, len(cfg.IgnoredDevices))
|
||||
copy(newCfg.IgnoredDevices, cfg.IgnoredDevices)
|
||||
|
||||
// FolderConfiguraion.ID is type string
|
||||
newCfg.IgnoredFolders = make([]string, len(cfg.IgnoredFolders))
|
||||
copy(newCfg.IgnoredFolders, cfg.IgnoredFolders)
|
||||
|
||||
return newCfg
|
||||
}
|
||||
|
||||
@@ -238,6 +243,9 @@ func (cfg *Configuration) clean() error {
|
||||
if cfg.IgnoredDevices == nil {
|
||||
cfg.IgnoredDevices = []protocol.DeviceID{}
|
||||
}
|
||||
if cfg.IgnoredFolders == nil {
|
||||
cfg.IgnoredFolders = []string{}
|
||||
}
|
||||
if cfg.Options.AlwaysLocalNets == nil {
|
||||
cfg.Options.AlwaysLocalNets = []string{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user