Skip to content

Conversation

@Aiiaiiio
Copy link
Collaborator

Solves #9004

The idea is:

  1. On startup, the enterprise update channel is set to invalid. Every time we get server capabilities we'll set the most stable enterprise update channel.
  2. When getting the update channel for the updater, we also check the enterprise channel, and use the most stable option.

const auto currentChannel = UpdateChannel::fromString(settings.value(QLatin1String(updateChannelC), defaultUpdateChannel()).toString());
const auto enterpriseChannel = UpdateChannel::fromString(desktopEnterpriseChannel());
return UpdateChannel::mostStable(currentChannel, enterpriseChannel).toString();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO these methods should return the values for the corresponding keys in the config file.
Keep in mind that the value of the desired enterprise channel should only be considered for unbranded clients connected to a server with a valid subscription, while branded clients only have the stable channel available.

also, since there is now a separate UpdateChannel class I think it would be cleaner to:

  • move the methods related to the update channel that are not really modifying the configuration from ConfigFile to that one (e.g. defaultUpdateChannel and validUpdateChannels)
  • add a function that determines the desired update channel (pretty much what defaultUpdateChannel does), and pass that as the channel query parameter in OCC::Updater
  • perhaps add some unit tests to verify which updater channel should be used

Comment on lines 298 to 301
// In the config, set the enterprise update channel to invalid, so it can be bumped up
// when recieving server capabilites.
ConfigFile configFile;
configFile.setDesktopEnterpriseChannel(UpdateChannel::fromString("invalid").toString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the current implementation of ConfigFile::setDesktopEnterpriseChannel this won't have any effect if the update channel is already set to enterprise

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. The info shown by the client mislead me.

Comment on lines 298 to 301
// In the config, set the enterprise update channel to invalid, so it can be bumped up
// when recieving server capabilites.
ConfigFile configFile;
configFile.setDesktopEnterpriseChannel(UpdateChannel::fromString("invalid").toString());

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so on every start, we will force override the value of the setting
why are we storing it if we are doing that ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good question. It was already there. But you're right it doesn't need to be in the config actually... I'll think some more about this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I think it's best to leave this config option in the config file. I cannot use a plain member in this class, because we create a new instance every time we want to access the config. I cannot really think of good place to put it either, because it is needed from multiple places. To leave it here is convenient.

@Rello Rello added this to the 4.0.3 milestone Nov 28, 2025
@@ -0,0 +1,60 @@
/*
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2025 ownCloud GmbH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new class not originally present in the forked-from codebase

Suggested change
* SPDX-FileCopyrightText: 2025 ownCloud GmbH

@@ -0,0 +1,44 @@
/*
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2025 ownCloud GmbH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new class not originally present in the forked-from codebase

Suggested change
* SPDX-FileCopyrightText: 2025 ownCloud GmbH

{
const auto capabilityEnterpriseChannel = UpdateChannel::fromString(_capabilities.desktopEnterpriseChannel());
_enterpriseUpdateChannel = capabilityEnterpriseChannel;
qCInfo(lcAccount()) << "lulu | enterp chn updated: " << _enterpriseUpdateChannel.toString() << " str: " << _capabilities.desktopEnterpriseChannel();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
qCInfo(lcAccount()) << "lulu | enterp chn updated: " << _enterpriseUpdateChannel.toString() << " str: " << _capabilities.desktopEnterpriseChannel();
qCInfo(lcAccount()) << "Account" << id() << "received enterprise channel:" << _enterpriseUpdateChannel.toString();

{
UpdateChannel most_stable_channel = UpdateChannel::Invalid;
for (const auto &account : std::as_const(_accounts)) {
if (auto accounts_channel = account->account()->enterpriseUpdateChannel(); accounts_channel > most_stable_channel) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to exclude accounts not having a valid subscription here as well

Copy link
Member

@nilsding nilsding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test itself looks fine to me, thanks :)

Comment on lines 48 to 50
FileInfo fi;
reply = new FakeFakeDeleteReply(this);
return reply;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • please add a comment why this QNAM override is required (e.g. side-effect of AccountManager::deleteAccount)
  • wouldn't an empty FakePayloadReply be enough here?
    Suggested change
    FileInfo fi;
    reply = new FakeFakeDeleteReply(this);
    return reply;
    reply = new FakePayloadReply(op, req, {}, this);

@Aiiaiiio Aiiaiiio requested review from mgallien and nilsding December 2, 2025 15:52
@Aiiaiiio Aiiaiiio force-pushed the bugfix/enforceEnterpriseUpdateChannel branch from 65b9865 to 116de06 Compare December 2, 2025 21:11
@nilsding nilsding modified the milestones: 4.0.3, 4.0.4 Dec 3, 2025
[issue 9004]

Signed-off-by: Tamás Bari <[email protected]>
But only if it's more stable.

Signed-off-by: Tamás Bari <[email protected]>
Force set the enterprise channel to invalid on startup.
Only provide the enterprise update channel is the server has a valid subscription.

Signed-off-by: Tamás Bari <[email protected]>
This approach integrates better into the current mechanisms.

Signed-off-by: Tamás Bari <[email protected]>
According to review suggetsions.

Signed-off-by: Tamás Bari <[email protected]>
Also removing the new one which did the same thing.

Signed-off-by: Tamás Bari <[email protected]>
@Aiiaiiio Aiiaiiio force-pushed the bugfix/enforceEnterpriseUpdateChannel branch from bf94adf to 8463862 Compare December 3, 2025 12:50
@Aiiaiiio Aiiaiiio enabled auto-merge December 3, 2025 12:51
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Artifact containing the AppImage: nextcloud-appimage-pr-9139.zip

Digest: sha256:839c72ed2ae10217d7aef2243f18f2eb8194d3c37319ccdbdf1f3cc78bbadefc

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@Aiiaiiio Aiiaiiio merged commit 848f6a1 into master Dec 3, 2025
20 checks passed
@Aiiaiiio Aiiaiiio deleted the bugfix/enforceEnterpriseUpdateChannel branch December 3, 2025 13:31
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
Image 74.1% Coverage on New Code (required ≥ 80%)
Image 160 New Code Smells (required ≤ 0)
Image D Security Rating on New Code (required ≥ A)
Image D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Image Catch issues before they fail your Quality Gate with our IDE extension Image SonarQube for IDE

@mgallien mgallien modified the milestones: 4.0.4, 4.1.0 Dec 3, 2025
@mgallien
Copy link
Collaborator

mgallien commented Dec 3, 2025

/backport to stable-4.0

@github-actions
Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants