Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable turbo drive #16486

Draft
wants to merge 48 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9f10cf3
Allow running turbo drive with reusing nonces in secure headers
oliverguenther May 17, 2024
ca2f70b
sync ui-router on turbo visits
oliverguenther May 17, 2024
15de103
Bootstrap root component again on turbo load
oliverguenther Aug 20, 2024
7045e83
Setup listeners so that they run on turbo:load
oliverguenther Aug 27, 2024
fa99c5b
Render with status: :unprocessable_entity
oliverguenther Aug 28, 2024
c7a208f
Disable prefetch again
oliverguenther Sep 12, 2024
e1dfb9b
Fix expectation
oliverguenther Sep 12, 2024
8064695
Wait for idle after sort
oliverguenther Sep 12, 2024
58de8c8
Fix redirects, render with turbo in users controller
oliverguenther Sep 12, 2024
d79a587
Fix top-menu not registered
oliverguenther Sep 12, 2024
c167eb5
Adapt password change spec
oliverguenther Sep 13, 2024
dd98d3d
Deal with no open dropdowns
oliverguenther Sep 13, 2024
1b57502
Fix en locale warning for ckeditor
oliverguenther Sep 13, 2024
d267e85
Ensure we use respond_to
oliverguenther Sep 13, 2024
47d62ba
Fix renders after redirect
oliverguenther Sep 13, 2024
6eb4782
Wait for idle between login requests
oliverguenther Sep 13, 2024
5a31de4
Close modals when turbo navigates
oliverguenther Sep 13, 2024
caffdc6
Fix superfluous expect
oliverguenther Sep 13, 2024
8a95295
Opt out of turbo for resend
oliverguenther Sep 13, 2024
620e58a
Fix meeting spec
oliverguenther Oct 8, 2024
c4f06ab
Disable turbo before redirect to index
oliverguenther Oct 8, 2024
1ea0dc7
Replace subform
oliverguenther Oct 10, 2024
c0f149f
Remove subform in cost types
oliverguenther Oct 10, 2024
0b29387
Fix datepicker cloning
oliverguenther Oct 10, 2024
32b2f4e
Disable turbo on new saml form
oliverguenther Oct 11, 2024
bbd4001
Fix registration spec using turbo
oliverguenther Oct 11, 2024
07861d8
Fix auth spec
oliverguenther Oct 11, 2024
cf94d35
Clear cookies in cuprite correctly
oliverguenther Oct 11, 2024
26c0df0
Fix bcf spec with cuprite
oliverguenther Oct 11, 2024
c5e4c7a
Merge branch 'dev' into experiment/enable-turbo-drive
oliverguenther Oct 17, 2024
9d1e54a
Check for presence of form link
oliverguenther Oct 17, 2024
9ccb841
Disable turbo after board creation
oliverguenther Oct 17, 2024
e8953e7
Disable cuprite while dragging doesn't work reliably
oliverguenther Oct 17, 2024
570240b
Remove duplicate opce-storage-login-button registration
oliverguenther Oct 17, 2024
e41456f
Use target: _top on meetings form
oliverguenther Oct 17, 2024
fefe59b
redirect without turbo
oliverguenther Oct 17, 2024
a4229e8
Target top on sort links
oliverguenther Oct 17, 2024
af4a707
Extend spec to use target=_top
oliverguenther Oct 18, 2024
98d92b4
compact on roles
oliverguenther Oct 18, 2024
1ccb13b
Reload attribute help texts to update previews
oliverguenther Oct 18, 2024
df2ec4e
wait for network_idle on logout_spec
oliverguenther Oct 18, 2024
e8b26ed
Fix forum upload spec
oliverguenther Oct 18, 2024
aa62d9c
Wait for idle
oliverguenther Oct 18, 2024
d5b6f91
Merge remote-tracking branch 'origin/dev' into experiment/enable-turb…
ulferts Oct 18, 2024
6fe6bf0
adapt secure_headers patched version
ulferts Oct 18, 2024
4ed3468
wait for network on user index tests
ulferts Oct 18, 2024
7e70cb5
fix spec by adding a success flash semaphore
ulferts Oct 18, 2024
7c3f6a9
properly destroy form configuration component
ulferts Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/controllers/account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,40 +377,44 @@
end
end

def password_authentication(username, password)
user = User.try_to_login(username, password, session)
if user.nil?
# login failed, now try to find out why and do the appropriate thing
user = User.find_by_login(username)
if user and user.check_password?(password)
# correct password
if not user.active?
account_inactive(user, flash_now: true)
render status: :unprocessable_entity
elsif user.force_password_change
return if redirect_if_password_change_not_allowed(user)

render_password_change(user, I18n.t(:notice_account_new_password_forced), show_user_name: true)
elsif user.password_expired?
return if redirect_if_password_change_not_allowed(user)

render_password_change(user, I18n.t(:notice_account_password_expired, days: Setting.password_days_valid.to_i),
show_user_name: true)
else
flash_and_log_invalid_credentials
render status: :unprocessable_entity
end
elsif user and user.invited?
invited_account_not_activated(user)
render status: :unprocessable_entity
else
# incorrect password
flash_and_log_invalid_credentials
render status: :unprocessable_entity
end
elsif user.new_record?
onthefly_creation_failed(user, login: user.login, ldap_auth_source_id: user.ldap_auth_source_id)
else
# Valid user
successful_authentication(user)
end
end

Check notice on line 417 in app/controllers/account_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/account_controller.rb#L380-L417 <Metrics/AbcSize>

Assignment Branch Condition size for password_authentication is too high. [<2, 31, 14> 34.07/17]
Raw output
app/controllers/account_controller.rb:380:3: C: Metrics/AbcSize: Assignment Branch Condition size for password_authentication is too high. [<2, 31, 14> 34.07/17]

Check notice on line 417 in app/controllers/account_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/account_controller.rb#L380-L417 <Metrics/PerceivedComplexity>

Perceived complexity for password_authentication is too high. [15/8]
Raw output
app/controllers/account_controller.rb:380:3: C: Metrics/PerceivedComplexity: Perceived complexity for password_authentication is too high. [15/8]

def invited_account_not_activated(_user)
flash_error_message(log_reason: "invited, NOT ACTIVATED", flash_now: false) do
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/angular_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class AngularController < ApplicationController
def empty_layout
# Frontend will handle rendering
# but we will need to render with layout
render html: "", layout: "angular/angular"
respond_to do |format|
format.html do
render html: "", layout: "angular/angular"
end
end
end

def login_back_url_params
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/attribute_help_texts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,34 @@

def edit; end

def create
call = ::AttributeHelpTexts::CreateService
.new(user: current_user)
.call(permitted_params_with_attachments)

if call.success?
flash[:notice] = t(:notice_successful_create)
redirect_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_entity
end
end

Check notice on line 60 in app/controllers/attribute_help_texts_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/attribute_help_texts_controller.rb#L47-L60 <Metrics/AbcSize>

Assignment Branch Condition size for create is too high. [<4, 19, 3> 19.65/17]
Raw output
app/controllers/attribute_help_texts_controller.rb:47:3: C: Metrics/AbcSize: Assignment Branch Condition size for create is too high. [<4, 19, 3> 19.65/17]

def update
call = ::AttributeHelpTexts::UpdateService
.new(user: current_user, model: @attribute_help_text)
.call(permitted_params_with_attachments)

if call.success?
flash[: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_entity
end
end

Check notice on line 74 in app/controllers/attribute_help_texts_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/attribute_help_texts_controller.rb#L62-L74 <Metrics/AbcSize>

Assignment Branch Condition size for update is too high. [<3, 17, 3> 17.52/17]
Raw output
app/controllers/attribute_help_texts_controller.rb:62:3: C: Metrics/AbcSize: Assignment Branch Condition size for update is too high. [<3, 17, 3> 17.52/17]

def destroy
if @attribute_help_text.destroy
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,31 @@
@category = @project.categories.build
end

def create
@category = @project.categories.build
@category.attributes = permitted_params.category

if @category.save
respond_to do |format|
format.html do
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to project_settings_categories_path(@project)
end
format.js do
render locals: { project: @project, category: @category }
end
end
else
respond_to do |format|
format.html do
render action: :new
render action: :new, status: :unprocessable_entity
end
format.js do
render(:update) { |page| page.alert(@category.errors.full_messages.join('\n')) }
end
end
end
end

Check notice on line 65 in app/controllers/categories_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/categories_controller.rb#L41-L65 <Metrics/AbcSize>

Assignment Branch Condition size for create is too high. [<6, 24, 2> 24.82/17]
Raw output
app/controllers/categories_controller.rb:41:3: C: Metrics/AbcSize: Assignment Branch Condition size for create is too high. [<6, 24, 2> 24.82/17]

def update
@category.attributes = permitted_params.category
Expand All @@ -70,7 +70,7 @@
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to project_settings_categories_path(@project)
else
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/colors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def create
redirect_to colors_path
else
flash.now[:error] = I18n.t(:error_color_could_not_be_saved)
render action: "new"
render action: :new, status: :unprocessable_entity
end
end

Expand All @@ -81,7 +81,7 @@ def update
redirect_to colors_path
else
flash.now[:error] = I18n.t(:error_color_could_not_be_saved)
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/accounts/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def respond_for_registered_user(user)
def onthefly_creation_failed(user, auth_source_options = {})
@user = user
session[:auth_source_registration] = auth_source_options unless auth_source_options.empty?
render action: "register"
render action: "register", status: :unprocessable_entity
end

def self_registration_disabled
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/accounts/user_password_change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def render_password_change(user, message, show_user_name: false)
flash[:error] = message unless message.nil?
@user = user
@username = user.login
render "my/password", locals: { show_user_name: }
render "my/password", locals: { show_user_name: }, status: :unprocessable_entity
end

##
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/concerns/custom_fields/shared_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@
end
end

def create
call = ::CustomFields::CreateService
.new(user: current_user)
.call(get_custom_field_params.merge(type: permitted_params.custom_field_type))

if call.success?
flash[:notice] = t(:notice_successful_create)
call_hook(:controller_custom_fields_new_after_save, custom_field: call.result)
redirect_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_entity
end
end

Check notice on line 63 in app/controllers/concerns/custom_fields/shared_actions.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/concerns/custom_fields/shared_actions.rb#L50-L63 <Metrics/AbcSize>

Assignment Branch Condition size for create is too high. [<3, 22, 3> 22.41/17]
Raw output
app/controllers/concerns/custom_fields/shared_actions.rb:50:7: C: Metrics/AbcSize: Assignment Branch Condition size for create is too high. [<3, 22, 3> 22.41/17]

def update
perform_update(get_custom_field_params)
Expand All @@ -76,7 +76,7 @@
call_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_entity
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/custom_actions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def index_or_render(render_action)

call.on_failure do
@custom_action = call.result
render action: render_action
render action: render_action, status: :unprocessable_entity
end
}
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/enterprises_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,28 @@
end
end

def create
@token = EnterpriseToken.current || EnterpriseToken.new
saved_encoded_token = @token.encoded_token
@token.encoded_token = params[:enterprise_token][:encoded_token]
if @token.save
flash[:notice] = t(:notice_successful_update)
respond_to do |format|
format.html { redirect_to action: :show }
format.json { head :no_content }
end
else
# restore the old token
if saved_encoded_token
@token.encoded_token = saved_encoded_token
@current_token = @token || EnterpriseToken.new
end
respond_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 }
end
end
end

Check notice on line 71 in app/controllers/enterprises_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/enterprises_controller.rb#L50-L71 <Metrics/AbcSize>

Assignment Branch Condition size for create is too high. [<8, 26, 5> 27.66/17]
Raw output
app/controllers/enterprises_controller.rb:50:3: C: Metrics/AbcSize: Assignment Branch Condition size for create is too high. [<8, 26, 5> 27.66/17]

def destroy
token = EnterpriseToken.current
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/enumerations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def create
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to action: "index", type: @enumeration.type
else
render action: "new"
render action: :new, status: :unprocessable_entity
end
end

Expand All @@ -70,7 +70,7 @@ def update
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to enumerations_path(type: @enumeration.type)
else
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand All @@ -96,7 +96,7 @@ def move
redirect_to enumerations_path
else
flash.now[:error] = I18n.t(:error_type_could_not_be_saved)
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/forums_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def move
flash[:notice] = t(:notice_successful_update)
else
flash.now[:error] = t("forum_could_not_be_saved")
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
redirect_to action: "index"
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def create
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to(groups_path)
else
render action: :new
render action: :new, status: :unprocessable_entity
end
end

Expand All @@ -77,7 +77,7 @@ def update
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to(groups_path)
else
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def create

redirect_to topic_path(@message)
else
render action: "new"
render action: :new, status: :unprocessable_entity
end
end

Expand Down Expand Up @@ -118,7 +118,7 @@ def update
@message.reload
redirect_to topic_path(@message.root, r: @message.parent_id && @message.id)
else
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/news_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def create
redirect_to controller: "/news", action: "index", project_id: @project
else
@news = call.result
render action: "new"
render action: :new, status: :unprocessable_entity
end
end

Expand All @@ -96,7 +96,7 @@ def update
redirect_to action: "show", id: @news
else
@news = call.result
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/oauth/applications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def create
redirect_to action: :show, id: result.id
else
@application = result
render action: :new
render action: :new, status: :unprocessable_entity
end
end

Expand All @@ -79,7 +79,7 @@ def update
redirect_to action: :index
else
flash[:error] = call.errors.full_messages.join('\n')
render action: :edit
render action: :edit, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/placeholder_users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,50 +79,50 @@
@individual_principal = @placeholder_user
end

def create
service = PlaceholderUsers::CreateService.new(user: User.current)
service_result = service.call(permitted_params.placeholder_user)
@placeholder_user = service_result.result

if service_result.success?
respond_to do |format|
format.html do
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to(params[:continue] ? new_placeholder_user_path : edit_placeholder_user_path(@placeholder_user))
end
end
else
respond_to do |format|
format.html do
render action: :new
render action: :new, status: :unprocessable_entity
end
end
end
end

Check notice on line 101 in app/controllers/placeholder_users_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/placeholder_users_controller.rb#L82-L101 <Metrics/AbcSize>

Assignment Branch Condition size for create is too high. [<6, 20, 3> 21.1/17]
Raw output
app/controllers/placeholder_users_controller.rb:82:3: C: Metrics/AbcSize: Assignment Branch Condition size for create is too high. [<6, 20, 3> 21.1/17]

def update
service_result = PlaceholderUsers::UpdateService
.new(user: User.current,
model: @placeholder_user)
.call(permitted_params.placeholder_user)

if service_result.success?
respond_to do |format|
format.html do
flash[:notice] = I18n.t(:notice_successful_update)
redirect_back(fallback_location: edit_placeholder_user_path(@placeholder_user))
end
end
else
@membership ||= Member.new

respond_to do |format|
format.html do
render action: :edit
render action: :edit, status: :unprocessable_entity
end
end
end
end

Check notice on line 125 in app/controllers/placeholder_users_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/placeholder_users_controller.rb#L103-L125 <Metrics/AbcSize>

Assignment Branch Condition size for update is too high. [<6, 17, 3> 18.28/17]
Raw output
app/controllers/placeholder_users_controller.rb:103:3: C: Metrics/AbcSize: Assignment Branch Condition size for update is too high. [<6, 17, 3> 18.28/17]

def deletion_info
respond_to :html
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/projects/identifier_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def update
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to project_settings_general_path(@project)
else
render action: "show"
render action: "show", status: :unprocessable_entity
end
end
end
6 changes: 3 additions & 3 deletions app/controllers/roles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def create
else
@roles = roles_scope

render action: "new"
render action: :new, status: :unprocessable_entity
end
end

Expand All @@ -77,7 +77,7 @@ def update
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: "index"
else
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down Expand Up @@ -111,7 +111,7 @@ def bulk_update
else
@calls = calls
@permissions = visible_permissions
render action: "report"
render action: "report", status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to action: "index"
else
render action: "new"
render action: :new, status: :unprocessable_entity
end
end

Expand All @@ -65,7 +65,7 @@ def update
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: "index"
else
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/types_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@
end
end

def create
CreateTypeService
.new(current_user)
.call(permitted_type_params, copy_workflow_from: params[:copy_workflow_from]) do |call|
@type = call.result

call.on_success do
redirect_to_type_tab_path(@type, t(:notice_successful_create))
end

call.on_failure do |result|
flash[:error] = result.errors.full_messages.join("\n")
load_projects_and_types
render action: "new"
render action: :new, status: :unprocessable_entity
end
end
end

Check notice on line 79 in app/controllers/types_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/types_controller.rb#L63-L79 <Metrics/AbcSize>

Assignment Branch Condition size for create is too high. [<4, 18, 0> 18.44/17]
Raw output
app/controllers/types_controller.rb:63:3: C: Metrics/AbcSize: Assignment Branch Condition size for create is too high. [<4, 18, 0> 18.44/17]

def update
UpdateTypeService
Expand All @@ -99,7 +99,7 @@
redirect_to types_path
else
flash.now[:error] = I18n.t(:error_type_could_not_be_saved)
render action: "edit"
render action: :edit, status: :unprocessable_entity
end
end

Expand Down Expand Up @@ -144,7 +144,7 @@
@projects = Project.all
@type = type

render action: "edit"
render action: :edit, status: :unprocessable_entity
end

def show_local_breadcrumb
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,54 +93,54 @@
flash[: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_entity
end
end

def update
update_params = build_user_update_params
call = ::Users::UpdateService.new(model: @user, user: current_user).call(update_params)

if call.success?
if update_params[:password].present? && @user.change_password_allowed?
send_information = params[:send_information]

if @user.invited?
# setting a password for an invited user activates them implicitly
if OpenProject::Enterprise.user_limit_reached?
@user.register!
show_user_limit_warning!
else
@user.activate!
end

send_information = true
end

if @user.active? && send_information
UserMailer.account_information(@user, update_params[:password]).deliver_later
end
end

respond_to do |format|
format.html do
flash[:notice] = I18n.t(:notice_successful_update)
render action: :edit
redirect_to action: :edit
end
end
else
@membership ||= Member.new
# Clear password input
@user = call.result
@user.password = @user.password_confirmation = nil

respond_to do |format|
format.html do
render action: :edit
render action: :edit, status: :unprocessable_entity
end
end
end
end

Check notice on line 143 in app/controllers/users_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/users_controller.rb#L100-L143 <Metrics/AbcSize>

Assignment Branch Condition size for update is too high. [<12, 32, 10> 35.61/17]
Raw output
app/controllers/users_controller.rb:100:3: C: Metrics/AbcSize: Assignment Branch Condition size for update is too high. [<12, 32, 10> 35.61/17]

Check notice on line 143 in app/controllers/users_controller.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/controllers/users_controller.rb#L100-L143 <Metrics/PerceivedComplexity>

Perceived complexity for update is too high. [11/8]
Raw output
app/controllers/users_controller.rb:100:3: C: Metrics/PerceivedComplexity: Perceived complexity for update is too high. [11/8]

def change_status_info
@status_change = params[:change_action].to_sym
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/versions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def render_cu(call, success_message, failure_action)
flash[:notice] = t(success_message)
redirect_back_or_version_settings
else
render action: failure_action
render action: failure_action, status: :unprocessable_entity
end
end

Expand Down
Loading
Loading