If the client is branded the default update channel is stable.
authorCamila Ayres <hello@camilasan.com>
Wed, 3 Jul 2024 22:00:11 +0000 (00:00 +0200)
committerCamila Ayres <hello@camilasan.com>
Thu, 4 Jul 2024 08:16:40 +0000 (10:16 +0200)
Signed-off-by: Camila Ayres <hello@camilasan.com>
src/libsync/configfile.cpp

index 8cc87e61668f0257ce18bcfb92bcd760e915bf3e..7b5a789b87f51102e4b79f71a7aa075801974550 100644 (file)
@@ -694,7 +694,13 @@ int ConfigFile::updateSegment() const
 
 QStringList ConfigFile::validUpdateChannels() const
 {
-    if (serverHasValidSubscription() && !Theme::instance()->isBranded()) {
+    const auto isBranded = Theme::instance()->isBranded();
+
+    if (isBranded) {
+        return { defaultUpdateChannelName };
+    }
+
+    if (serverHasValidSubscription()) {
         return enterpriseUpdateChannelsList;
     }
 
@@ -703,7 +709,8 @@ QStringList ConfigFile::validUpdateChannels() const
 
 QString ConfigFile::defaultUpdateChannel() const
 {
-    if (serverHasValidSubscription() && !Theme::instance()->isBranded()) {
+    const auto isBranded = Theme::instance()->isBranded();
+    if (serverHasValidSubscription() && !isBranded) {
         if (const auto serverChannel = desktopEnterpriseChannel();
             validUpdateChannels().contains(serverChannel)) {
             qCWarning(lcConfigFile()) << "Enforcing update channel" << serverChannel << "because that is the desktop enterprise channel returned by the server.";
@@ -712,11 +719,12 @@ QString ConfigFile::defaultUpdateChannel() const
     }
 
     if (const auto currentVersionSuffix = Theme::instance()->versionSuffix();
-        validUpdateChannels().contains(currentVersionSuffix)) {
+        validUpdateChannels().contains(currentVersionSuffix) && !isBranded) {
         qCWarning(lcConfigFile()) << "Enforcing update channel" << currentVersionSuffix << "because of the version suffix of the current client.";
         return currentVersionSuffix;
     }
 
+    qCWarning(lcConfigFile()) << "Enforcing default update channel" << defaultUpdateChannelName;
     return defaultUpdateChannelName;
 }