Skip to content

Commit 15aee4a

Browse files
committed
fix: Set the current update channel together with the enterprise channel
But only if it's more stable. Signed-off-by: Tamás Bari <[email protected]>
1 parent e5bb8df commit 15aee4a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/libsync/configfile.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
#include "config.h"
88

9+
#include "common/asserts.h"
10+
#include "common/utility.h"
911
#include "configfile.h"
1012
#include "theme.h"
11-
#include "version.h"
12-
#include "common/utility.h"
13-
#include "common/asserts.h"
13+
#include "updatechannel.h"
1414
#include "version.h"
1515

1616
#include "creds/abstractcredentials.h"
@@ -1216,6 +1216,9 @@ void ConfigFile::setDesktopEnterpriseChannel(const QString &channel)
12161216
{
12171217
QSettings settings(configFile(), QSettings::IniFormat);
12181218
settings.setValue(QLatin1String(desktopEnterpriseChannelName), channel);
1219+
const auto currentUpdateChannel = UpdateChannel::fromString(this->currentUpdateChannel());
1220+
const auto newEnterpriseUpdateChannel = UpdateChannel::fromString(channel);
1221+
setUpdateChannel(UpdateChannel::mostStable(currentUpdateChannel, newEnterpriseUpdateChannel).toString());
12191222
}
12201223

12211224
QString ConfigFile::language() const

src/libsync/updatechannel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ QString UpdateChannel::toString() const
2525

2626
std::strong_ordering UpdateChannel::operator<=>(const UpdateChannel &rhs) const = default;
2727

28+
UpdateChannel UpdateChannel::mostStable(const UpdateChannel &a, const UpdateChannel &b)
29+
{
30+
return std::max(a, b);
31+
}
32+
2833
UpdateChannel UpdateChannel::fromString(const QString &channelName) // static
2934
{
3035
using enum ChannelName;

src/libsync/updatechannel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class UpdateChannel
2727
std::strong_ordering operator<=>(const UpdateChannel &rhs) const;
2828

2929
static UpdateChannel fromString(const QString &channelName);
30+
static UpdateChannel mostStable(const UpdateChannel &a, const UpdateChannel &b);
3031

3132
private:
3233
UpdateChannel();

0 commit comments

Comments
 (0)