gui, lib/config: Add notification about new release channels
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3945
This commit is contained in:
@@ -21,12 +21,13 @@ import (
|
||||
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/rand"
|
||||
"github.com/syncthing/syncthing/lib/upgrade"
|
||||
"github.com/syncthing/syncthing/lib/util"
|
||||
)
|
||||
|
||||
const (
|
||||
OldestHandledVersion = 10
|
||||
CurrentVersion = 17
|
||||
CurrentVersion = 18
|
||||
MaxRescanIntervalS = 365 * 24 * 60 * 60
|
||||
)
|
||||
|
||||
@@ -257,6 +258,9 @@ func (cfg *Configuration) clean() error {
|
||||
if cfg.Version == 16 {
|
||||
convertV16V17(cfg)
|
||||
}
|
||||
if cfg.Version == 17 {
|
||||
convertV17V18(cfg)
|
||||
}
|
||||
|
||||
// Build a list of available devices
|
||||
existingDevices := make(map[protocol.DeviceID]bool)
|
||||
@@ -310,6 +314,24 @@ func (cfg *Configuration) clean() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func convertV17V18(cfg *Configuration) {
|
||||
// Do channel selection for existing users. Those who have auto upgrades
|
||||
// and usage reporting on default to the candidate channel. Others get
|
||||
// stable.
|
||||
if cfg.Options.URAccepted > 0 && cfg.Options.AutoUpgradeIntervalH > 0 {
|
||||
cfg.Options.UpgradeToPreReleases = true
|
||||
}
|
||||
|
||||
// Show a notification to explain what's going on, except if upgrades
|
||||
// are disabled by compilation or environment variable in which case
|
||||
// it's not relevant.
|
||||
if !upgrade.DisabledByCompilation && os.Getenv("STNOUPGRADE") == "" {
|
||||
cfg.Options.UnackedNotificationIDs = append(cfg.Options.UnackedNotificationIDs, "channelNotification")
|
||||
}
|
||||
|
||||
cfg.Version = 18
|
||||
}
|
||||
|
||||
func convertV14V15(cfg *Configuration) {
|
||||
// Undo v0.13.0 broken migration
|
||||
|
||||
|
||||
@@ -200,9 +200,12 @@ func TestOverriddenValues(t *testing.T) {
|
||||
AlwaysLocalNets: []string{},
|
||||
OverwriteRemoteDevNames: true,
|
||||
TempIndexMinBlocks: 100,
|
||||
UnackedNotificationIDs: []string{},
|
||||
UnackedNotificationIDs: []string{
|
||||
"channelNotification", // added in 17->18 migration
|
||||
},
|
||||
}
|
||||
|
||||
os.Unsetenv("STNOUPGRADE")
|
||||
cfg, err := Load("testdata/overridenvalues.xml", device1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
||||
15
lib/config/testdata/v18.xml
vendored
Normal file
15
lib/config/testdata/v18.xml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<configuration version="18">
|
||||
<folder id="test" path="testdata" type="readonly" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
|
||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||
<minDiskFreePct>1</minDiskFreePct>
|
||||
<maxConflicts>-1</maxConflicts>
|
||||
<fsync>true</fsync>
|
||||
</folder>
|
||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR" name="node one" compression="metadata">
|
||||
<address>tcp://a</address>
|
||||
</device>
|
||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2" name="node two" compression="metadata">
|
||||
<address>tcp://b</address>
|
||||
</device>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user