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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
feat[Op#55133]: Render flash message and re-render table on stale unlink
Kabiru Mwenja581049039035
diff --git a/app/controllers/admin/settings/project_custom_fields_controller.rb b/app/controllers/admin/settings/project_custom_fields_controller.rbindex a23139a70dd..81d6eeb3a9e 100644--- a/app/controllers/admin/settings/project_custom_fields_controller.rb+++ b/app/controllers/admin/settings/project_custom_fields_controller.rb@@ -30,6 +30,7 @@ module Admin::Settingsclass ProjectCustomFieldsController < ::Admin::SettingsControllerinclude CustomFields::SharedActionsinclude OpTurbo::ComponentStream+ include ApplicationComponentStreamsinclude Admin::Settings::ProjectCustomFields::ComponentStreamsmenu_item :project_custom_fields_settings@@ -41,6 +42,7 @@ module Admin::Settingsbefore_action :prepare_custom_option_position, only: %i(update create)before_action :find_custom_option, only: :delete_optionbefore_action :project_custom_field_mappings_query, only: %i[project_mappings unlink]+ before_action :find_unlink_project_custom_field_mapping, only: %i[unlink]# rubocop:enable Rails/LexicallyScopedActionFilterdef show_local_breadcrumb@@ -68,10 +70,8 @@ module Admin::Settingsdef project_mappings; enddef unlink- 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:)delete_service = ProjectCustomFieldProjectMappings::DeleteService- .new(user: current_user, model: project_custom_field_mapping)+ .new(user: current_user, model: @project_custom_field_mapping).calldelete_service.on_success { render_unlink_response(project:) }@@ -150,6 +150,23 @@ module Admin::Settings.allend+ 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)+ rescue ActiveRecord::RecordNotFound+ update_flash_message_via_turbo_stream(+ message: t(:notice_file_not_found), full: true, dismiss_scheme: :hide, scheme: :danger+ )+ replace_via_turbo_stream(+ component: Settings::ProjectCustomFields::ProjectCustomFieldMapping::TableComponent.new(+ query: project_custom_field_mappings_query,+ params: { custom_field: @custom_field }+ )+ )++ respond_with_turbo_streams+ end+def find_custom_field@custom_field = ProjectCustomField.find(params[:id])rescue ActiveRecord::RecordNotFound