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

Make (Un)ArchiveService usage discoverable by IDEs

Christophe Bliard8bd9531fd11f
diff --git a/app/controllers/projects/archive_controller.rb b/app/controllers/projects/archive_controller.rb
index 91182663e3c..0c32d1c1dd2 100644
--- a/app/controllers/projects/archive_controller.rb
+++ b/app/controllers/projects/archive_controller.rb
@@ -54,12 +54,18 @@ class Projects::ArchiveController < ApplicationController
end
def change_status(status)
- "Projects::#{status.to_s.camelcase}Service"
- .constantize
+ service_class(status)
.new(user: current_user, model: @project)
.call
end
+ def service_class(status)
+ case status
+ when :archive then Projects::ArchiveService
+ when :unarchive then Projects::UnarchiveService
+ end
+ end
+
def project_path_with_status
acceptable_params = params.permit(:status).to_h.compact.select { |_, v| v.present? }