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
Render with status: :unprocessable_entity
Oliver Güntherfa99c5bef6d0
diff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rbindex 44aa15e6085..87637eed4bb 100644--- a/app/controllers/attribute_help_texts_controller.rb+++ b/app/controllers/attribute_help_texts_controller.rb@@ -54,8 +54,8 @@ class AttributeHelpTextsController < ApplicationControllerredirect_to attribute_help_texts_path(tab: call.result.attribute_scope)else@attribute_help_text = call.result- flash[:error] = call.message || I18n.t("notice_internal_server_error")- render action: "new"+ flash.now[:error] = call.message || I18n.t("notice_internal_server_error")+ render action: "new", status: :unprocessable_entityendend@@ -68,8 +68,8 @@ class AttributeHelpTextsController < ApplicationControllerflash[:notice] = t(:notice_successful_update)redirect_to attribute_help_texts_path(tab: @attribute_help_text.attribute_scope)else- flash[:error] = call.message || I18n.t("notice_internal_server_error")- render action: "edit"+ flash.now[:error] = call.message || I18n.t("notice_internal_server_error")+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rbindex b41f73c4759..0d8db7a9324 100644--- a/app/controllers/categories_controller.rb+++ b/app/controllers/categories_controller.rb@@ -55,7 +55,7 @@ class CategoriesController < ApplicationControllerelserespond_to do |format|format.html do- render action: :new+ render action: :new, status: :unprocessable_entityendformat.js dorender(:update) { |page| page.alert(@category.errors.full_messages.join('\n')) }@@ -70,7 +70,7 @@ class CategoriesController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_update)redirect_to project_settings_categories_path(@project)else- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rbindex ed553c1ce1c..9aba619dff5 100644--- a/app/controllers/colors_controller.rb+++ b/app/controllers/colors_controller.rb@@ -69,7 +69,7 @@ class ColorsController < ApplicationControllerredirect_to colors_pathelseflash.now[:error] = I18n.t(:error_color_could_not_be_saved)- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -81,7 +81,7 @@ class ColorsController < ApplicationControllerredirect_to colors_pathelseflash.now[:error] = I18n.t(:error_color_could_not_be_saved)- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/concerns/custom_fields/shared_actions.rb b/app/controllers/concerns/custom_fields/shared_actions.rbindex 44928935ff0..6ef1aee1df7 100644--- a/app/controllers/concerns/custom_fields/shared_actions.rb+++ b/app/controllers/concerns/custom_fields/shared_actions.rb@@ -58,7 +58,7 @@ module CustomFieldsredirect_to index_path(call.result, tab: call.result.class.name)else@custom_field = call.result || new_custom_field- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -76,7 +76,7 @@ module CustomFieldscall_hook(:controller_custom_fields_edit_after_save, custom_field: @custom_field)redirect_back_or_default(edit_path(@custom_field, id: @custom_field.id))else- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/custom_actions_controller.rb b/app/controllers/custom_actions_controller.rbindex a7296b63959..a2ec48df759 100644--- a/app/controllers/custom_actions_controller.rb+++ b/app/controllers/custom_actions_controller.rb@@ -77,7 +77,7 @@ class CustomActionsController < ApplicationControllercall.on_failure do@custom_action = call.result- render action: render_action+ render action: render_action, status: :unprocessable_entityend}enddiff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rbindex a011ec00375..1c3dffe176e 100644--- a/app/controllers/enterprises_controller.rb+++ b/app/controllers/enterprises_controller.rb@@ -64,7 +64,7 @@ class EnterprisesController < ApplicationController@current_token = @token || EnterpriseToken.newendrespond_to do |format|- format.html { render action: :show }+ format.html { render action: :show, status: :unprocessable_entity }format.json { render json: { description: @token.errors.full_messages.join(", ") }, status: :bad_request }endenddiff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rbindex e9dfc358734..c1b2be5ec7d 100644--- a/app/controllers/enumerations_controller.rb+++ b/app/controllers/enumerations_controller.rb@@ -58,7 +58,7 @@ class EnumerationsController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_create)redirect_to action: "index", type: @enumeration.typeelse- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -70,7 +70,7 @@ class EnumerationsController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_update)redirect_to enumerations_path(type: @enumeration.type)else- render action: "edit"+ render action: :edit, status: :unprocessable_entityendend@@ -96,7 +96,7 @@ class EnumerationsController < ApplicationControllerredirect_to enumerations_pathelseflash.now[:error] = I18n.t(:error_type_could_not_be_saved)- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rbindex 1def837243c..434b7686ffd 100644--- a/app/controllers/forums_controller.rb+++ b/app/controllers/forums_controller.rb@@ -111,7 +111,7 @@ class ForumsController < ApplicationControllerflash[:notice] = t(:notice_successful_update)elseflash.now[:error] = t("forum_could_not_be_saved")- render action: "edit"+ render action: :edit, status: :unprocessable_entityendredirect_to action: "index"enddiff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex 1694553a9fc..82de14c39b8 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -64,7 +64,7 @@ class GroupsController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_create)redirect_to(groups_path)else- render action: :new+ render action: :new, status: :unprocessable_entityendend@@ -77,7 +77,7 @@ class GroupsController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_update)redirect_to(groups_path)else- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rbindex d9e44f4aa30..ee25591af6a 100644--- a/app/controllers/messages_controller.rb+++ b/app/controllers/messages_controller.rb@@ -89,7 +89,7 @@ class MessagesController < ApplicationControllerredirect_to topic_path(@message)else- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -118,7 +118,7 @@ class MessagesController < ApplicationController@message.reloadredirect_to topic_path(@message.root, r: @message.parent_id && @message.id)else- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rbindex 1a36644447a..4e851f18bb9 100644--- a/app/controllers/news_controller.rb+++ b/app/controllers/news_controller.rb@@ -82,7 +82,7 @@ class NewsController < ApplicationControllerredirect_to controller: "/news", action: "index", project_id: @projectelse@news = call.result- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -96,7 +96,7 @@ class NewsController < ApplicationControllerredirect_to action: "show", id: @newselse@news = call.result- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rbindex 0d32225d584..04686f9e908 100644--- a/app/controllers/oauth/applications_controller.rb+++ b/app/controllers/oauth/applications_controller.rb@@ -61,7 +61,7 @@ module OAuthredirect_to action: :show, id: result.idelse@application = result- render action: :new+ render action: :new, status: :unprocessable_entityendend@@ -79,7 +79,7 @@ module OAuthredirect_to action: :indexelseflash[:error] = call.errors.full_messages.join('\n')- render action: :edit+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rbindex 82d6660e274..809fd062e27 100644--- a/app/controllers/placeholder_users_controller.rb+++ b/app/controllers/placeholder_users_controller.rb@@ -94,7 +94,7 @@ class PlaceholderUsersController < ApplicationControllerelserespond_to do |format|format.html do- render action: :new+ render action: :new, status: :unprocessable_entityendendend@@ -118,7 +118,7 @@ class PlaceholderUsersController < ApplicationControllerrespond_to do |format|format.html do- render action: :edit+ render action: :edit, status: :unprocessable_entityendendenddiff --git a/app/controllers/projects/identifier_controller.rb b/app/controllers/projects/identifier_controller.rbindex 57462a5a531..f8527c7d4ba 100644--- a/app/controllers/projects/identifier_controller.rb+++ b/app/controllers/projects/identifier_controller.rb@@ -42,7 +42,7 @@ class Projects::IdentifierController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_update)redirect_to project_settings_general_path(@project)else- render action: "show"+ render action: "show", status: :unprocessable_entityendendenddiff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rbindex d4c2e0d08fb..33d2bcbd23f 100644--- a/app/controllers/roles_controller.rb+++ b/app/controllers/roles_controller.rb@@ -65,7 +65,7 @@ class RolesController < ApplicationControllerelse@roles = roles_scope- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -77,7 +77,7 @@ class RolesController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_update)redirect_to action: "index"else- render action: "edit"+ render action: :edit, status: :unprocessable_entityendend@@ -111,7 +111,7 @@ class RolesController < ApplicationControllerelse@calls = calls@permissions = visible_permissions- render action: "report"+ render action: "report", status: :unprocessable_entityendenddiff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rbindex fa15c4ef341..cd097715a84 100644--- a/app/controllers/statuses_controller.rb+++ b/app/controllers/statuses_controller.rb@@ -54,7 +54,7 @@ class StatusesController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_create)redirect_to action: "index"else- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -65,7 +65,7 @@ class StatusesController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_update)redirect_to action: "index"else- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rbindex 31c8ad25cd7..caa766f881e 100644--- a/app/controllers/types_controller.rb+++ b/app/controllers/types_controller.rb@@ -73,7 +73,7 @@ class TypesController < ApplicationControllercall.on_failure do |result|flash[:error] = result.errors.full_messages.join("\n")load_projects_and_types- render action: "new"+ render action: :new, status: :unprocessable_entityendendend@@ -99,7 +99,7 @@ class TypesController < ApplicationControllerredirect_to types_pathelseflash.now[:error] = I18n.t(:error_type_could_not_be_saved)- render action: "edit"+ render action: :edit, status: :unprocessable_entityendend@@ -144,7 +144,7 @@ class TypesController < ApplicationController@projects = Project.all@type = type- render action: "edit"+ render action: :edit, status: :unprocessable_entityenddef show_local_breadcrumbdiff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rbindex 006335e2d3c..30fced4ded5 100644--- a/app/controllers/users_controller.rb+++ b/app/controllers/users_controller.rb@@ -93,7 +93,7 @@ class UsersController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_create)redirect_to(params[:continue] ? new_user_path : helpers.allowed_management_user_profile_path(@user))else- render action: "new"+ render action: :new, status: :unprocessable_entityendenddiff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rbindex 87d25fe223d..15d5ea200f5 100644--- a/app/controllers/versions_controller.rb+++ b/app/controllers/versions_controller.rb@@ -159,7 +159,7 @@ class VersionsController < ApplicationControllerflash[:notice] = t(success_message)redirect_back_or_version_settingselse- render action: failure_action+ render action: failure_action, status: :unprocessable_entityendenddiff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rbindex 95538c1a28c..a61732e9fdb 100644--- a/app/controllers/wiki_controller.rb+++ b/app/controllers/wiki_controller.rb@@ -144,7 +144,7 @@ class WikiController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_create)redirect_to_showelse- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -170,12 +170,12 @@ class WikiController < ApplicationControllerflash[:notice] = I18n.t(:notice_successful_update)redirect_to_showelse- render action: "edit"+ render action: :edit, status: :unprocessable_entityendrescue ActiveRecord::StaleObjectError# Optimistic locking exceptionflash.now[:error] = I18n.t(:notice_locking_conflict)- render action: "edit"+ render action: :edit, status: :unprocessable_entityend# rename a pagediff --git a/app/controllers/wiki_menu_items_controller.rb b/app/controllers/wiki_menu_items_controller.rbindex 1a035cc1da6..94ac13da4a1 100644--- a/app/controllers/wiki_menu_items_controller.rb+++ b/app/controllers/wiki_menu_items_controller.rb@@ -105,7 +105,7 @@ class WikiMenuItemsController < ApplicationControllerelserespond_to do |format|format.html do- render action: "edit", id: @page+ render action: :edit, id: @page, status: :unprocessable_entityendendenddiff --git a/app/controllers/work_packages/bulk_controller.rb b/app/controllers/work_packages/bulk_controller.rbindex 8030b41f7ce..f2938d63a95 100644--- a/app/controllers/work_packages/bulk_controller.rb+++ b/app/controllers/work_packages/bulk_controller.rb@@ -52,7 +52,7 @@ class WorkPackages::BulkController < ApplicationControllerelseflash[:error] = bulk_error_message(@work_packages, @call)setup_edit- render action: :edit+ render action: :edit, status: :unprocessable_entityendenddiff --git a/modules/auth_saml/app/controllers/saml/providers_controller.rb b/modules/auth_saml/app/controllers/saml/providers_controller.rbindex ab8a43a11fe..b1da54f8a66 100644--- a/modules/auth_saml/app/controllers/saml/providers_controller.rb+++ b/modules/auth_saml/app/controllers/saml/providers_controller.rb@@ -63,7 +63,7 @@ module Saml@edit_state = :metadataflash.now[:error] = call.message- render action: :edit+ render action: :edit, status: :unprocessable_entityendend@@ -78,7 +78,7 @@ module Samlsuccessful_save_responseelseflash.now[:error] = call.message- render action: :new+ render action: :new, status: :unprocessable_entityendenddiff --git a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rbindex c80963a7d60..32d47c39c97 100644--- a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb+++ b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb@@ -149,7 +149,7 @@ module Bimflash[:notice] = t("ifc_models.flash_messages.upload_successful")redirect_to action: :indexelse- render action: :new+ render action: :new, status: :unprocessable_entityendend@@ -168,7 +168,7 @@ module Bimflash[:notice] = t(:notice_successful_update)redirect_to action: :indexelse- render action: :edit+ render action: :edit, status: :unprocessable_entityendenddiff --git a/modules/boards/app/controllers/boards/boards_controller.rb b/modules/boards/app/controllers/boards/boards_controller.rbindex b9a271d5d53..a39108f49f6 100644--- a/modules/boards/app/controllers/boards/boards_controller.rb+++ b/modules/boards/app/controllers/boards/boards_controller.rb@@ -40,7 +40,7 @@ module ::Boardsflash[:notice] = I18n.t(:notice_successful_create)redirect_to project_work_package_board_path(@project, @board_grid)else- render action: :new+ render action: :new, status: :unprocessable_entityendenddiff --git a/modules/budgets/app/controllers/budgets_controller.rb b/modules/budgets/app/controllers/budgets_controller.rbindex e9b626e2792..7f01d8adf16 100644--- a/modules/budgets/app/controllers/budgets_controller.rb+++ b/modules/budgets/app/controllers/budgets_controller.rb@@ -111,7 +111,7 @@ class BudgetsController < ApplicationControllerflash[:notice] = t(:notice_successful_create)redirect_to(params[:continue] ? { action: "new" } : { action: "show", id: @budget })else- render action: "new", layout: !request.xhr?+ render action: "new", status: :unprocessable_entity, layout: !request.xhr?endend@@ -129,7 +129,7 @@ class BudgetsController < ApplicationControllerredirect_to(@budget)else@budget = call.result- render action: "edit"+ render action: :edit, status: :unprocessable_entityendrescue ActiveRecord::StaleObjectError# Optimistic locking exceptiondiff --git a/modules/calendar/app/controllers/calendar/calendars_controller.rb b/modules/calendar/app/controllers/calendar/calendars_controller.rbindex 5b8280d60d1..373cb2bec67 100644--- a/modules/calendar/app/controllers/calendar/calendars_controller.rb+++ b/modules/calendar/app/controllers/calendar/calendars_controller.rb@@ -61,7 +61,7 @@ module ::Calendarflash[:notice] = I18n.t(:notice_successful_create)redirect_to project_calendar_path(@project, @view.query)else- render action: :new+ render action: :new, status: :unprocessable_entityendenddiff --git a/modules/costs/app/controllers/cost_types_controller.rb b/modules/costs/app/controllers/cost_types_controller.rbindex 3706912993e..07db5d36403 100644--- a/modules/costs/app/controllers/cost_types_controller.rb+++ b/modules/costs/app/controllers/cost_types_controller.rb@@ -62,7 +62,7 @@ class CostTypesController < ApplicationControllerenddef edit- render action: "edit", layout: !request.xhr?+ render action: :edit, layout: !request.xhr?enddef update@@ -72,7 +72,7 @@ class CostTypesController < ApplicationControllerflash[:notice] = t(:notice_successful_update)redirect_back_or_default(action: "index")else- render action: "edit", layout: !request.xhr?+ render action: :edit, status: :unprocessable_entity, layout: !request.xhr?endrescue ActiveRecord::StaleObjectError# Optimistic locking exception@@ -84,7 +84,7 @@ class CostTypesController < ApplicationController@cost_type.rates.build(valid_from: Date.today) if @cost_type.rates.empty?- render action: "edit", layout: !request.xhr?+ render action: :edit, layout: !request.xhr?enddef create@@ -95,7 +95,7 @@ class CostTypesController < ApplicationControllerredirect_back_or_default(action: "index")else@cost_type.rates.build(valid_from: Date.today) if @cost_type.rates.empty?- render action: "edit", layout: !request.xhr?+ render action: :edit, status: :unprocessable_entity, layout: !request.xhr?endrescue ActiveRecord::StaleObjectError# Optimistic locking exceptiondiff --git a/modules/costs/app/controllers/costlog_controller.rb b/modules/costs/app/controllers/costlog_controller.rbindex d0cf40f823b..386ff243689 100644--- a/modules/costs/app/controllers/costlog_controller.rb+++ b/modules/costs/app/controllers/costlog_controller.rb@@ -57,7 +57,7 @@ class CostlogController < ApplicationControllerflash[:notice] = t(:notice_cost_logged_successfully)redirect_back_or_default work_package_path(@cost_entry.work_package)else- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/modules/costs/app/controllers/hourly_rates_controller.rb b/modules/costs/app/controllers/hourly_rates_controller.rbindex c9077d4ad5c..768bf891d99 100644--- a/modules/costs/app/controllers/hourly_rates_controller.rb+++ b/modules/costs/app/controllers/hourly_rates_controller.rb@@ -78,7 +78,7 @@ class HourlyRatesController < ApplicationController@rates << @user.rates.build(valid_from: Date.today, project: @project) if @rates.empty?end- render action: "edit", layout: !request.xhr?+ render action: :edit, layout: !request.xhr?endcurrent_menu_item :edit do@@ -123,7 +123,7 @@ class HourlyRatesController < ApplicationController.sort { |a, b| b.valid_from || Date.today <=> a.valid_from || Date.today }@rates << @user.rates.build(valid_from: Date.today, project: @project) if @rates.empty?end- render action: "edit", layout: !request.xhr?+ render action: :edit, layout: !request.xhr?endenddiff --git a/modules/costs/spec/controllers/costlog_controller_spec.rb b/modules/costs/spec/controllers/costlog_controller_spec.rbindex bdd5e0b97d4..b3f78082d94 100644--- a/modules/costs/spec/controllers/costlog_controller_spec.rb+++ b/modules/costs/spec/controllers/costlog_controller_spec.rb@@ -303,7 +303,7 @@ RSpec.describe CostlogController dopost :create, params:end- it { expect(response).to be_successful }+ it { expect(response).to have_http_status(:unprocessable_entity) }it_behaves_like "assigns"it { expect(flash[:notice]).to be_nil }diff --git a/modules/documents/app/controllers/documents_controller.rb b/modules/documents/app/controllers/documents_controller.rbindex 7222cb7ea03..db5b2133fa8 100644--- a/modules/documents/app/controllers/documents_controller.rb+++ b/modules/documents/app/controllers/documents_controller.rb@@ -71,7 +71,7 @@ class DocumentsController < ApplicationControllerredirect_to project_documents_path(@project)else@document = call.result- render action: "new"+ render action: :new, status: :unprocessable_entityendend@@ -89,7 +89,7 @@ class DocumentsController < ApplicationControllerredirect_to action: "show", id: @documentelse@document = call.result- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/modules/ldap_groups/app/controllers/ldap_groups/synchronized_filters_controller.rb b/modules/ldap_groups/app/controllers/ldap_groups/synchronized_filters_controller.rbindex 1226a9cc37f..2b6882dac60 100644--- a/modules/ldap_groups/app/controllers/ldap_groups/synchronized_filters_controller.rb+++ b/modules/ldap_groups/app/controllers/ldap_groups/synchronized_filters_controller.rb@@ -24,7 +24,7 @@ module LdapGroupsflash[:notice] = I18n.t(:notice_successful_create)redirect_to ldap_groups_synchronized_groups_pathelse- render action: :new+ render action: :new, status: :unprocessable_entityendrescue ActionController::ParameterMissingrender_400@@ -35,7 +35,7 @@ module LdapGroupsflash[:notice] = I18n.t(:notice_successful_update)redirect_to action: :showelse- render action: :edit+ render action: :edit, status: :unprocessable_entityendrescue ActionController::ParameterMissingrender_400diff --git a/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rb b/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rbindex 11276c1a3e1..ec7dd07cb07 100644--- a/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rb+++ b/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rb@@ -28,7 +28,7 @@ module LdapGroupsflash[:notice] = I18n.t(:notice_successful_create)redirect_to action: :indexelse- render action: :new+ render action: :new, status: :unprocessable_entityendrescue ActionController::ParameterMissingrender_400diff --git a/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb b/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rbindex a600b3218ae..0ed0521fe7b 100644--- a/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb+++ b/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb@@ -135,7 +135,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupscontext "and saving fails" doit "renders new page" do- expect(response).to have_http_status(:ok)+ expect(response).to have_http_status(:unprocessable_entity)expect(response).to render_template :newendenddiff --git a/modules/meeting/app/controllers/meeting_contents_controller.rb b/modules/meeting/app/controllers/meeting_contents_controller.rbindex 43335a4ebb3..a4c29b88831 100644--- a/modules/meeting/app/controllers/meeting_contents_controller.rb+++ b/modules/meeting/app/controllers/meeting_contents_controller.rb@@ -69,7 +69,7 @@ class MeetingContentsController < ApplicationControllerelseflash.now[:error] = call.messageparams[:tab] ||= "minutes" if @meeting.agenda.present? && @meeting.agenda.locked?- render "meetings/show"+ render "meetings/show", status: :unprocessable_entityendenddiff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 5fb9334eb5c..4cdcb3a5832 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -122,7 +122,7 @@ class MeetingsController < ApplicationController.call(save: false)@meeting = call.result- render action: "new", project_id: @project, locals: { copy_from: }+ render action: :new, status: :unprocessable_entity, project_id: @project, locals: { copy_from: }enddef destroy@@ -167,7 +167,7 @@ class MeetingsController < ApplicationControllerredirect_to action: "show", id: @meetingelse@meeting = call.result- render action: "edit"+ render action: :edit, status: :unprocessable_entityendenddiff --git a/modules/meeting/spec/controllers/meetings_controller_spec.rb b/modules/meeting/spec/controllers/meetings_controller_spec.rbindex 3987e81a9f8..ede030d0bc6 100644--- a/modules/meeting/spec/controllers/meetings_controller_spec.rb+++ b/modules/meeting/spec/controllers/meetings_controller_spec.rb@@ -164,7 +164,7 @@ RSpec.describe MeetingsController doendit "renders an error" do- expect(response).to have_http_status :ok+ expect(response).to have_http_status :unprocessable_entityexpect(response).to render_template :newexpect(response.body).to have_text("Date #{I18n.t('activerecord.errors.messages.not_an_iso_date')}")@@ -177,7 +177,7 @@ RSpec.describe MeetingsController doendit "renders an error" do- expect(response).to have_http_status :ok+ expect(response).to have_http_status :unprocessable_entityexpect(response).to render_template :newexpect(response.body).to have_text("Start time #{I18n.t('activerecord.errors.messages.invalid_time_format')}")@@ -189,7 +189,7 @@ RSpec.describe MeetingsController dolet(:project) { nil }it "renders an error" do- expect(response).to have_http_status :ok+ expect(response).to have_http_status :unprocessable_entityexpect(response).to render_template :newexpect(response.body).to have_text("Project #{I18n.t('activerecord.errors.messages.blank')}")@@ -201,7 +201,7 @@ RSpec.describe MeetingsController dolet(:project) { nil }it "renders an error" do- expect(response).to have_http_status :ok+ expect(response).to have_http_status :unprocessable_entityexpect(response).to render_template :newexpect(response.body).to have_text("Project #{I18n.t('activerecord.errors.messages.blank')}")diff --git a/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb b/modules/openid_connect/app/controllers/openid_connect/providers_controller.rbindex ac436d6418f..1d7c6a3e003 100644--- a/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb+++ b/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb@@ -24,7 +24,7 @@ module OpenIDConnectflash[:notice] = I18n.t(:notice_successful_create)redirect_to action: :indexelse- render action: :new+ render action: :new, status: :unprocessable_entityendend@@ -38,7 +38,7 @@ module OpenIDConnectflash[:notice] = I18n.t(:notice_successful_update)redirect_to action: :indexelse- render action: :edit+ render action: :edit, status: :unprocessable_entityendenddiff --git a/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb b/modules/team_planner/app/controllers/team_planner/team_planner_controller.rbindex a2e08ebef42..6b04456e264 100644--- a/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb+++ b/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb@@ -30,7 +30,7 @@ module ::TeamPlannerflash[:notice] = I18n.t(:notice_successful_create)redirect_to project_team_planner_path(@project, @view.query)else- render action: :new+ render action: :new, status: :unprocessable_entityendenddiff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rbindex 91918c4199e..a48d1f42934 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb@@ -54,7 +54,7 @@ module ::TwoFactorAuthenticationendelseRails.logger.warn { "User ##{target_user.id} forced to register failed for #{@device_type}." }- render "two_factor_authentication/two_factor_devices/new"+ render "two_factor_authentication/two_factor_devices/new", status: :unprocessable_entityendenddiff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rbindex 37210741f3e..8577a42b784 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb@@ -67,7 +67,7 @@ module ::TwoFactorAuthenticationendelseRails.logger.warn { "User ##{current_user.id} failed to register a device #{@device_type}." }- render "two_factor_authentication/two_factor_devices/new"+ render "two_factor_authentication/two_factor_devices/new", status: :unprocessable_entityendenddiff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rbindex 7d438e05e25..3f04b5085c2 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb@@ -34,7 +34,7 @@ module ::TwoFactorAuthenticationredirect_to index_pathelseRails.logger.info "Admin ##{current_user.id} failed to register a new device #{@device_type} for #{@user.id}."- render "two_factor_authentication/two_factor_devices/new"+ render "two_factor_authentication/two_factor_devices/new", status: :unprocessable_entityendenddiff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rbindex 7822efd1f35..0cf89ac791e 100644--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb@@ -98,7 +98,7 @@ RSpec.describe TwoFactorAuthentication::ForcedRegistration::TwoFactorDevicesContlet(:params) { { identifier: "foo" } }it "renders action new" do- expect(response).to be_successful+ expect(response).to have_http_status :unprocessable_entityexpect(response).to render_template "new"expect(assigns[:device]).to be_invalidenddiff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rbindex 08560809f19..24b4d4200fc 100644--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb@@ -92,7 +92,7 @@ RSpec.describe TwoFactorAuthentication::My::TwoFactorDevicesController dolet(:params) { { identifier: "foo" } }it "renders action new" do- expect(response).to be_successful+ expect(response).to have_http_status :unprocessable_entityexpect(response).to render_template "new"expect(assigns[:device]).to be_invalidenddiff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rbindex a843d38dc37..ee7f4cdee9e 100644--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb@@ -108,7 +108,7 @@ RSpec.describe TwoFactorAuthentication::Users::TwoFactorDevicesController doit "renders action new" dopost :register, params: { id: user.id, key: :sms, device: params }- expect(response).to be_successful+ expect(response).to have_http_status :unprocessable_entityexpect(response).to render_template "new"expect(assigns[:device]).to be_invalidenddiff --git a/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb b/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rbindex b6dfbde6517..688c61eae9a 100644--- a/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb+++ b/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb@@ -28,7 +28,7 @@ module Webhooksredirect_to action: :indexelse@webhook = action.result- render action: :new+ render action: :new, status: :unprocessable_entityendend@@ -40,7 +40,7 @@ module Webhooksredirect_to action: :indexelse@webhook = action.result- render action: :edit+ render action: :edit, status: :unprocessable_entityendenddiff --git a/spec/controllers/attribute_help_texts_controller_spec.rb b/spec/controllers/attribute_help_texts_controller_spec.rbindex 061db98398f..cba0cef13b1 100644--- a/spec/controllers/attribute_help_texts_controller_spec.rb+++ b/spec/controllers/attribute_help_texts_controller_spec.rb@@ -98,7 +98,7 @@ RSpec.describe AttributeHelpTextsController doendit "fails to update the announcement" do- expect(response).to be_successful+ expect(response).to have_http_status(:unprocessable_entity)expect(response).to render_template "edit"endenddiff --git a/spec/controllers/news_controller_spec.rb b/spec/controllers/news_controller_spec.rbindex d4cc219016a..ba594072e1e 100644--- a/spec/controllers/news_controller_spec.rb+++ b/spec/controllers/news_controller_spec.rb@@ -128,7 +128,7 @@ RSpec.describe NewsController do}}- expect(response).to be_successful+ expect(response).to have_http_status(:unprocessable_entity)expect(response).to render_template "new"expect(assigns(:news)).not_to be_nilexpect(assigns(:news)).to be_new_recorddiff --git a/spec/controllers/placeholder_users_controller_spec.rb b/spec/controllers/placeholder_users_controller_spec.rbindex 6ef8a294ec1..adfd9a2e9af 100644--- a/spec/controllers/placeholder_users_controller_spec.rb+++ b/spec/controllers/placeholder_users_controller_spec.rb@@ -103,7 +103,7 @@ RSpec.describe PlaceholderUsersController docontext "without ee" doit "returns with an error" doexpect { post :create, params: }.not_to change { PlaceholderUser.count }- expect(response).to be_successful+ expect(response).to have_http_status(:unprocessable_entity)expect(assigns(:placeholder_user).errors.details[:base]).to eq([error: :error_enterprise_only, action: "Placeholder Users"])diff --git a/spec/controllers/projects/identifier_controller_spec.rb b/spec/controllers/projects/identifier_controller_spec.rbindex 72203ecc119..db259be2f06 100644--- a/spec/controllers/projects/identifier_controller_spec.rb+++ b/spec/controllers/projects/identifier_controller_spec.rb@@ -48,7 +48,7 @@ RSpec.describe Projects::IdentifierController doprevious_identifier = project.identifierput :update, params: { project_id: project.id, project: { identifier: "bad identifier" } }- expect(response).to have_http_status(:ok)+ expect(response).to have_http_status(:unprocessable_entity)expect(response.body).to include("Identifier is invalid")expect(project.reload.identifier).to eq(previous_identifier)enddiff --git a/spec/controllers/roles_controller_spec.rb b/spec/controllers/roles_controller_spec.rbindex 23313eb6c27..ab4cfe89ddb 100644--- a/spec/controllers/roles_controller_spec.rb+++ b/spec/controllers/roles_controller_spec.rb@@ -123,24 +123,11 @@ RSpec.describe RolesController docontext "failure" dolet(:service_call) { ServiceResult.failure(result: new_role) }- it "returns a 200 OK" do- expect(response)- .to have_http_status(:ok)- end-- it "renders the new template" do- expect(response)- .to render_template("roles/new")- end-- it "has the service call assigned" do- expect(assigns[:call])- .to eql service_call- end-- it "has the role assigned" do- expect(assigns[:role])- .to eql new_role+ it "renders the new form again", :aggregate_failures do+ expect(response).to have_http_status(:unprocessable_entity)+ expect(response).to render_template("roles/new")+ expect(assigns[:call]).to eql service_call+ expect(assigns[:role]).to eql new_roleendendend@@ -206,24 +193,11 @@ RSpec.describe RolesController docontext "failure" dolet(:service_call) { ServiceResult.failure(result: role) }- it "returns a 200 OK" do- expect(response)- .to have_http_status(:ok)- end-- it "renders the edit template" do- expect(response)- .to render_template("roles/edit")- end-- it "has the service call assigned" do- expect(assigns[:call])- .to eql service_call- end-- it "has the role assigned" do- expect(assigns[:role])- .to eql role+ it "renders edit again", :aggregate_failures do+ expect(response).to have_http_status(:unprocessable_entity)+ expect(response).to render_template("roles/edit")+ expect(assigns[:call]).to eql service_call+ expect(assigns[:role]).to eql roleendendend@@ -349,24 +323,11 @@ RSpec.describe RolesController docontext "failure" dolet(:service_call2) { ServiceResult.failure(result: role2) }- it "returns a 200 OK" do- expect(response)- .to have_http_status(:ok)- end-- it "renders the report template" do- expect(response)- .to render_template("roles/report")- end-- it "has the service call assigned" do- expect(assigns[:calls])- .to contain_exactly(service_call0, service_call1, service_call2, service_call3)- end-- it "has the roles assigned" do- expect(assigns[:roles])- .to match_array roles+ it "renders the report again" do+ expect(response).to have_http_status(:unprocessable_entity)+ expect(response).to render_template("roles/report")+ expect(assigns[:calls]).to contain_exactly(service_call0, service_call1, service_call2, service_call3)+ expect(assigns[:roles]).to match_array rolesendendenddiff --git a/spec/controllers/types_controller_spec.rb b/spec/controllers/types_controller_spec.rbindex 02320fe53c0..5130db3b52b 100644--- a/spec/controllers/types_controller_spec.rb+++ b/spec/controllers/types_controller_spec.rb@@ -161,7 +161,7 @@ RSpec.describe TypesController dopost :create, params:end- it { expect(response).to have_http_status(:ok) }+ it { expect(response).to have_http_status(:unprocessable_entity) }it "shows an error message" doexpect(response.body).to have_content("Name can't be blank")@@ -214,7 +214,7 @@ RSpec.describe TypesController doget "edit", params: { id: type.id, tab: :settings }end- it { expect(response).to be_successful }+ it { expect(response).to have_http_status(:unprocessable_entity) }it { expect(response).to render_template "edit" }it { expect(response).to render_template "types/form/_settings" }it { expect(response.body).to have_css "input[@name='type[name]'][@value='My type']" }@@ -233,7 +233,7 @@ RSpec.describe TypesController doget "edit", params: { id: type.id, tab: :projects }end- it { expect(response).to be_successful }+ it { expect(response).to have_http_status(:unprocessable_entity) }it { expect(response).to render_template "edit" }it { expect(response).to render_template "types/form/_projects" }diff --git a/spec/controllers/versions_controller_spec.rb b/spec/controllers/versions_controller_spec.rbindex 597092fb749..086eca8a86a 100644--- a/spec/controllers/versions_controller_spec.rb+++ b/spec/controllers/versions_controller_spec.rb@@ -340,7 +340,7 @@ RSpec.describe VersionsController do}end- it { expect(response).to be_successful }+ it { expect(response).to have_http_status(:unprocessable_entity) }it { expect(response).to render_template("edit") }it { expect(assigns(:version).errors.symbols_for(:name)).to contain_exactly(:blank) }enddiff --git a/spec/requests/statuses_spec.rb b/spec/requests/statuses_spec.rbindex d74758cf330..62482dabeaa 100644--- a/spec/requests/statuses_spec.rb+++ b/spec/requests/statuses_spec.rb@@ -47,7 +47,7 @@ RSpec.describe "Statuses", :skip_csrf, type: :rails_request doit "displays an error" dopost statuses_path, params: { status: { name: "New status", default_done_ratio: "" } }- expect(response).to have_http_status(:success)+ expect(response).to have_http_status(:unprocessable_entity)expect(response).to render_template("new")expect(response.body).to include("% Complete must be between 0 and 100.")end