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]: remove unneded unsafe hash and extra DB Call

Kabiru Mwenja25cb5db441dd
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 231ac3bc286..8f69e323e74 100644
--- a/app/controllers/admin/custom_fields/custom_field_projects_controller.rb
+++ b/app/controllers/admin/custom_fields/custom_field_projects_controller.rb
@@ -133,8 +133,8 @@ class Admin::CustomFields::CustomFieldProjectsController < ApplicationController
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)
+ @custom_field_project = CustomFieldsProject.find_by!(custom_field: @custom_field,
+ project: params[:custom_fields_project][:project_id])
rescue ActiveRecord::RecordNotFound
respond_with_project_not_found_turbo_streams
end
diff --git a/app/controllers/admin/settings/project_custom_fields_controller.rb b/app/controllers/admin/settings/project_custom_fields_controller.rb
index 2b10ab128af..e8ba9ceb344 100644
--- a/app/controllers/admin/settings/project_custom_fields_controller.rb
+++ b/app/controllers/admin/settings/project_custom_fields_controller.rb
@@ -181,8 +181,9 @@ module Admin::Settings
end
def find_unlink_project_custom_field_mapping
- @project = Project.find(permitted_params.project_custom_field_project_mapping[:project_id])
- @project_custom_field_mapping = @custom_field.project_custom_field_project_mappings.find_by!(project: @project)
+ @project_custom_field_mapping = @custom_field.project_custom_field_project_mappings.find_by!(
+ project_id: permitted_params.project_custom_field_project_mapping[:project_id]
+ )
rescue ActiveRecord::RecordNotFound
update_flash_message_via_turbo_stream(
message: t(:notice_file_not_found), full: true, dismiss_scheme: :hide, scheme: :danger