Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#57068] Nextcloud "recheck connection" checks for GroupFolderApp though AMPF is deactivated

Pavel Balashoudc77722a7f72
diff --git a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb
index faae38e2758..b5645fa7a4e 100644
--- a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb
+++ b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb
@@ -83,7 +83,7 @@ module Storages
capabilities = query.result
- if !capabilities.app_enabled? || !capabilities.group_folder_enabled?
+ if !capabilities.app_enabled? || (@storage.automatically_managed? && !capabilities.group_folder_enabled?)
app_name = if capabilities.app_enabled?
I18n.t("storages.dependencies.nextcloud.group_folders_app")
else
@@ -114,28 +114,26 @@ module Storages
min_group_folder_version = SemanticVersion.parse(config.dig("dependencies", "group_folders_app", "min_version"))
capabilities = query.result
- fetched_app_version = capabilities.app_version
- fetched_group_folder_version = capabilities.group_folder_version
- if fetched_app_version < min_app_version
+ if capabilities.app_version < min_app_version
Some(
ConnectionValidation.new(
type: :error,
error_code: :err_unexpected_version,
timestamp: Time.current,
description: I18n.t("storages.health.connection_validation.app_version_mismatch",
- found: fetched_app_version.to_s,
+ found: capabilities.app_version.to_s,
expected: min_app_version.to_s)
)
)
- elsif fetched_group_folder_version < min_group_folder_version
+ elsif @storage.automatically_managed? && capabilities.group_folder_version < min_group_folder_version
Some(
ConnectionValidation.new(
type: :error,
error_code: :err_unexpected_version,
timestamp: Time.current,
description: I18n.t("storages.health.connection_validation.group_folder_version_mismatch",
- found: fetched_group_folder_version.to_s,
+ found: capabilities.group_folder_version.to_s,
expected: min_group_folder_version.to_s)
)
)
diff --git a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb
index 3a0109f4a59..1ab254fd0ed 100644
--- a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb
@@ -59,7 +59,7 @@ RSpec.describe Storages::Peripherals::NextcloudConnectionValidator do
end
context "if request returns a capabilities response" do
- let(:storage) { create(:nextcloud_storage_configured) }
+ let(:storage) { create(:nextcloud_storage_configured, :as_automatically_managed) }
let(:app_enabled) { true }
let(:app_version) { Storages::SemanticVersion.parse("2.6.3") }
let(:group_folder_enabled) { true }
@@ -110,6 +110,15 @@ RSpec.describe Storages::Peripherals::NextcloudConnectionValidator do
expect(subject.description).to eq("A required dependency is missing on the file storage. " \
"Please add the following dependency: Group folders.")
end
+
+ context "if storage is not automatically_managed" do
+ let(:storage) { create(:nextcloud_storage_configured) }
+
+ it "does not check group_folder app" do
+ expect(subject.type).to eq(:healthy)
+ expect(subject.error_code).to eq(:none)
+ end
+ end
end
context "with outdated group folder app" do
@@ -121,6 +130,15 @@ RSpec.describe Storages::Peripherals::NextcloudConnectionValidator do
expect(subject.description)
.to eq("The Group Folder version is not supported. Please update your Nextcloud server.")
end
+
+ context "if storage is not automatically_managed" do
+ let(:storage) { create(:nextcloud_storage_configured) }
+
+ it "does not check group_folder app" do
+ expect(subject.type).to eq(:healthy)
+ expect(subject.error_code).to eq(:none)
+ end
+ end
end
end
end