Browse Source

gui, lib/config: Add notification about new release channels

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3945
Jakob Borg 9 years ago
parent
commit
3eb7a9373a

+ 6 - 0
gui/default/assets/lang/lang-en.json

@@ -22,6 +22,7 @@
    "An external command handles the versioning. It has to remove the file from the synced folder.": "An external command handles the versioning. It has to remove the file from the synced folder.",
    "Anonymous Usage Reporting": "Anonymous Usage Reporting",
    "Any devices configured on an introducer device will be added to this device as well.": "Any devices configured on an introducer device will be added to this device as well.",
+   "Automatic upgrade now offers the choice between stable releases and release candidates.": "Automatic upgrade now offers the choice between stable releases and release candidates.",
    "Automatic upgrades": "Automatic upgrades",
    "Be careful!": "Be careful!",
    "Bugs": "Bugs",
@@ -104,6 +105,7 @@
    "Last seen": "Last seen",
    "Later": "Later",
    "Latest Change": "Latest Change",
+   "Learn more": "Learn more",
    "Listeners": "Listeners",
    "Local Discovery": "Local Discovery",
    "Local State": "Local State",
@@ -148,6 +150,7 @@
    "Random": "Random",
    "Reduced by ignore patterns": "Reduced by ignore patterns",
    "Release Notes": "Release Notes",
+   "Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.": "Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.",
    "Remote Devices": "Remote Devices",
    "Remove": "Remove",
    "Required identifier for the folder. Must be the same on all cluster devices.": "Required identifier for the folder. Must be the same on all cluster devices.",
@@ -184,6 +187,7 @@
    "Smallest First": "Smallest First",
    "Source Code": "Source Code",
    "Stable releases and release candidates": "Stable releases and release candidates",
+   "Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.": "Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.",
    "Stable releases only": "Stable releases only",
    "Staggered File Versioning": "Staggered File Versioning",
    "Start Browser": "Start Browser",
@@ -250,6 +254,8 @@
    "When adding a new device, keep in mind that this device must be added on the other side too.": "When adding a new device, keep in mind that this device must be added on the other side too.",
    "When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.",
    "Yes": "Yes",
+   "You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialog.",
+   "You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
    "You must keep at least one version.": "You must keep at least one version.",
    "days": "days",
    "directories": "directories",

+ 27 - 0
gui/default/syncthing/core/notifications.html

@@ -14,3 +14,30 @@
   </div>
 </notification>
 -->
+
+<notification id="channelNotification">
+  <div class="panel panel-success">
+    <div class="panel-heading">
+      <h3 class="panel-title"><span class="fa fa-flash"></span>&nbsp;<span translate>Automatic upgrades</span></h3>
+    </div>
+    <div class="panel-body">
+      <p translate>Automatic upgrade now offers the choice between stable releases and release candidates.</p>
+      <p>
+      <span translate>Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.</span>
+      <span translate>Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.</span>
+      <span translate>You can read more about the two release channels at the link below.</span>
+      </p>
+      <p translate>You can change your choice at any time in the Settings dialog.</p>
+      <p><a href="https://docs.syncthing.net/users/releases.html"><span class="fa fa-fw fa-book"></span>&nbsp;<span translate>Learn more</span></a></p>
+    </div>
+    <div class="panel-footer">
+      <button type="button" class="btn btn-sm btn-default pull-right" ng-click="editSettings()">
+        <span class="fa fa-cog"></span>&nbsp;<span translate>Settings</span>
+      </button>
+      <button type="button" class="btn btn-sm btn-default" ng-click="dismiss()">
+        <span class="fa fa-check"></span>&nbsp;<span translate>OK</span>
+      </button>
+      <div class="clearfix"></div>
+    </div>
+  </div>
+</notification>

+ 23 - 1
lib/config/config.go

@@ -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
 

+ 4 - 1
lib/config/config_test.go

@@ -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 - 0
lib/config/testdata/v18.xml

@@ -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>