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

chore[Op#57516]: extract method, not found turbo stream response

Kabiru Mwenja44e0bb391bb8
diff --git a/app/controllers/admin/custom_fields/custom_field_projects_controller.rb b/app/controllers/admin/custom_fields/custom_field_projects_controller.rb
index 32ce2877a81..231ac3bc286 100644
--- a/app/controllers/admin/custom_fields/custom_field_projects_controller.rb
+++ b/app/controllers/admin/custom_fields/custom_field_projects_controller.rb
@@ -129,23 +129,14 @@ class Admin::CustomFields::CustomFieldProjectsController < ApplicationController
respond_with_turbo_streams
end
rescue ActiveRecord::RecordNotFound
- update_flash_message_via_turbo_stream message: t(:notice_project_not_found), full: true, dismiss_scheme: :hide,
- scheme: :danger
- update_project_list_via_turbo_stream
-
- respond_with_turbo_streams
+ respond_with_project_not_found_turbo_streams
end
def find_custom_field_project_to_destroy
@project = Project.find(params.to_unsafe_h[:custom_fields_project][:project_id])
@custom_field_project = CustomFieldsProject.find_by!(custom_field: @custom_field, project: @project)
rescue ActiveRecord::RecordNotFound
- update_flash_message_via_turbo_stream(
- message: t(:notice_project_not_found), full: true, dismiss_scheme: :hide, scheme: :danger
- )
- update_project_list_via_turbo_stream
-
- respond_with_turbo_streams
+ respond_with_project_not_found_turbo_streams
end
def update_project_list_via_turbo_stream(url_for_action: action_name)
@@ -174,6 +165,14 @@ class Admin::CustomFields::CustomFieldProjectsController < ApplicationController
.result
end
+ def respond_with_project_not_found_turbo_streams
+ update_flash_message_via_turbo_stream message: t(:notice_project_not_found), full: true, dismiss_scheme: :hide,
+ scheme: :danger
+ update_project_list_via_turbo_stream
+
+ respond_with_turbo_streams
+ end
+
def include_sub_projects?
ActiveRecord::Type::Boolean.new.cast(params.to_unsafe_h[:custom_fields_project][:include_sub_projects])
end