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

Correct/ignore Rubocop offenses in UsersController

Alexander Brandon Coles78cbbaccc4f7
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index cb916592082..c257e1949e4 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -150,7 +150,7 @@ class UsersController < ApplicationController
render_400 unless %i(activate lock unlock).include? @status_change
end
- def change_status # rubocop:disable Metrics/AbcSize
+ def change_status # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
if @user.id == current_user.id
# user is not allowed to change own status
redirect_back_or_default({ action: "edit", id: @user })
@@ -189,7 +189,7 @@ class UsersController < ApplicationController
redirect_back_or_default({ action: "edit", id: @user })
end
- def resend_invitation
+ def resend_invitation # rubocop:disable Metrics/AbcSize
status = Principal.statuses[:invited]
@user.update status: status if @user.status != status
@@ -288,7 +288,7 @@ class UsersController < ApplicationController
false
end
- def build_user_update_params
+ def build_user_update_params # rubocop:disable Metrics/AbcSize
pref_params = permitted_params.pref.to_h
update_params = permitted_params
.user_create_as_admin(@user.uses_external_authentication?, @user.change_password_allowed?)
@@ -305,10 +305,8 @@ class UsersController < ApplicationController
force_password_change: true
)
elsif set_password? params
- update_params.merge!(
- password: params[:user][:password],
- password_confirmation: params[:user][:password_confirmation]
- )
+ update_params[:password] = params[:user][:password]
+ update_params[:password_confirmation] = params[:user][:password_confirmation]
end
update_params