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

Rename NextcloudAudience* components to StorageAudience*

Jan Sandbrink9e8ec5734107
diff --git a/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb b/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb
index 5b82883415c..b03004d6b96 100644
--- a/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb
+++ b/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb
@@ -61,7 +61,7 @@ module Storages
namespace("forms") do
register(:automatically_managed_folders, ::Storages::Admin::Forms::AutomaticallyManagedProjectFoldersFormComponent)
register(:general_information, ::Storages::Admin::Forms::GeneralInfoFormComponent)
- register(:storage_audience, ::Storages::Admin::Forms::NextcloudAudienceFormComponent)
+ register(:storage_audience, ::Storages::Admin::Forms::StorageAudienceFormComponent)
register(:oauth_application, ::Storages::Admin::OAuthApplicationInfoCopyComponent)
register(:oauth_client, ::Storages::Admin::Forms::OAuthClientFormComponent)
end
@@ -70,7 +70,7 @@ module Storages
register(:automatically_managed_folders, ::Storages::Admin::AutomaticallyManagedProjectFoldersInfoComponent)
register(:general_information, ::Storages::Admin::GeneralInfoComponent)
- register(:storage_audience, ::Storages::Admin::NextcloudAudienceInfoComponent)
+ register(:storage_audience, ::Storages::Admin::StorageAudienceInfoComponent)
register(:oauth_application, ::Storages::Admin::OAuthApplicationInfoComponent)
register(:oauth_client, ::Storages::Admin::OAuthClientInfoComponent)
end
diff --git a/modules/storages/app/components/storages/admin/forms/nextcloud_audience_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/storage_audience_form_component.html.erb
similarity index 96%
rename from modules/storages/app/components/storages/admin/forms/nextcloud_audience_form_component.html.erb
rename to modules/storages/app/components/storages/admin/forms/storage_audience_form_component.html.erb
index 45b9345723c..b2d8307d4bf 100644
--- a/modules/storages/app/components/storages/admin/forms/nextcloud_audience_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/storage_audience_form_component.html.erb
@@ -42,7 +42,7 @@ See COPYRIGHT and LICENSE files for more details.
) do |form|
flex_layout do |general_info_row|
general_info_row.with_row(mb: 3) do
- render(Storages::Admin::NextcloudAudienceInputForm.new(form))
+ render(Storages::Admin::StorageAudienceInputForm.new(form))
end
general_info_row.with_row do
diff --git a/modules/storages/app/components/storages/admin/forms/nextcloud_audience_form_component.rb b/modules/storages/app/components/storages/admin/forms/storage_audience_form_component.rb
similarity index 96%
rename from modules/storages/app/components/storages/admin/forms/nextcloud_audience_form_component.rb
rename to modules/storages/app/components/storages/admin/forms/storage_audience_form_component.rb
index c4aa2a3be7e..e6c13ef0178 100644
--- a/modules/storages/app/components/storages/admin/forms/nextcloud_audience_form_component.rb
+++ b/modules/storages/app/components/storages/admin/forms/storage_audience_form_component.rb
@@ -29,7 +29,7 @@
#++
#
module Storages::Admin::Forms
- class NextcloudAudienceFormComponent < StorageFormComponent
+ class StorageAudienceFormComponent < StorageFormComponent
def self.wrapper_key = :storage_audience_section
options submit_button_disabled: false
diff --git a/modules/storages/app/components/storages/admin/nextcloud_audience_info_component.erb b/modules/storages/app/components/storages/admin/storage_audience_info_component.erb
similarity index 100%
rename from modules/storages/app/components/storages/admin/nextcloud_audience_info_component.erb
rename to modules/storages/app/components/storages/admin/storage_audience_info_component.erb
diff --git a/modules/storages/app/components/storages/admin/nextcloud_audience_info_component.rb b/modules/storages/app/components/storages/admin/storage_audience_info_component.rb
similarity index 96%
rename from modules/storages/app/components/storages/admin/nextcloud_audience_info_component.rb
rename to modules/storages/app/components/storages/admin/storage_audience_info_component.rb
index 70a49123e33..2571cd4c091 100644
--- a/modules/storages/app/components/storages/admin/nextcloud_audience_info_component.rb
+++ b/modules/storages/app/components/storages/admin/storage_audience_info_component.rb
@@ -30,7 +30,7 @@
module Storages
module Admin
- class NextcloudAudienceInfoComponent < StorageInfoComponent
+ class StorageAudienceInfoComponent < StorageInfoComponent
def self.wrapper_key = :storage_audience_section
def audience_summary
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb
index c23db058f91..1c4069f76f9 100644
--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb
@@ -124,7 +124,7 @@ class Storages::Admin::StoragesController < ApplicationController
end
def edit_storage_audience
- update_via_turbo_stream(component: Storages::Admin::Forms::NextcloudAudienceFormComponent.new(@storage))
+ update_via_turbo_stream(component: Storages::Admin::Forms::StorageAudienceFormComponent.new(@storage))
respond_with_turbo_streams
end
diff --git a/modules/storages/app/forms/storages/admin/nextcloud_audience_input_form.rb b/modules/storages/app/forms/storages/admin/storage_audience_input_form.rb
similarity index 98%
rename from modules/storages/app/forms/storages/admin/nextcloud_audience_input_form.rb
rename to modules/storages/app/forms/storages/admin/storage_audience_input_form.rb
index 3823c2fc7fc..73e9555e71b 100644
--- a/modules/storages/app/forms/storages/admin/nextcloud_audience_input_form.rb
+++ b/modules/storages/app/forms/storages/admin/storage_audience_input_form.rb
@@ -29,7 +29,7 @@
#++
module Storages::Admin
- class NextcloudAudienceInputForm < ApplicationForm
+ class StorageAudienceInputForm < ApplicationForm
form do |storage_form|
storage_form.radio_button_group(name: :audience_configuration) do |group|
group.radio_button(
diff --git a/modules/storages/spec/components/storages/admin/storage_audience_info_component_spec.rb b/modules/storages/spec/components/storages/admin/storage_audience_info_component_spec.rb
new file mode 100644
index 00000000000..72e39108781
--- /dev/null
+++ b/modules/storages/spec/components/storages/admin/storage_audience_info_component_spec.rb
@@ -0,0 +1,60 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+#
+require "spec_helper"
+require_module_spec_helper
+
+RSpec.describe Storages::Admin::OAuthClientInfoComponent, type: :component do # rubocop:disable RSpec/SpecFilePathFormat
+ describe "#edit_icon_button_options" do
+ context "with oauth client configured" do
+ it "returns false, does not render view component" do
+ storage = build_stubbed(:nextcloud_storage,
+ oauth_client: build_stubbed(:oauth_client))
+ component = described_class.new(storage)
+ expect(component.edit_icon_button_options)
+ .to include(icon: :sync,
+ data: { turbo_confirm:
+ "This action will reset the current OAuth credentials. After confirming you will " \
+ "have to enter new credentials from the storage provider and all users will have " \
+ "to authorize against Nextcloud again. Are you sure you want to proceed?",
+ turbo_stream: true })
+ end
+ end
+
+ context "without oauth client" do
+ it "returns true, renders view component" do
+ storage = build_stubbed(:nextcloud_storage)
+ component = described_class.new(storage)
+
+ edit_icon_button_data_options = component.edit_icon_button_options
+ expect(edit_icon_button_data_options).to include(icon: :pencil, data: { turbo_stream: true })
+ expect(edit_icon_button_data_options[:data]).not_to include(:confirm)
+ end
+ end
+ end
+end