diff options
author | Robert Speicher <rspeicher@gmail.com> | 2018-12-15 01:58:57 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-12-17 04:40:35 +0300 |
commit | 7a07be5693f6dad1b27e568fc3961f5307f7012f (patch) | |
tree | e8b4869d0b813d2fd8a62891b5409da6ca9d61e7 /app/services | |
parent | 8b4602041cf2c4a8738a4796d78720017249249f (diff) |
Change deprecated `except!` usages
These can just be `delete` calls, with the caveat that it only takes one
argument.
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/groups/update_service.rb | 2 | ||||
-rw-r--r-- | app/services/merge_requests/update_service.rb | 9 | ||||
-rw-r--r-- | app/services/users/update_service.rb | 10 |
3 files changed, 12 insertions, 9 deletions
diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb index 0bf0e967dcc..31d3c844ad5 100644 --- a/app/services/groups/update_service.rb +++ b/app/services/groups/update_service.rb @@ -36,7 +36,7 @@ module Groups end def reject_parent_id! - params.except!(:parent_id) + params.delete(:parent_id) end def valid_share_with_group_lock_change? diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index aacaf10d09c..33d8299c8b6 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -5,14 +5,15 @@ module MergeRequests def execute(merge_request) # We don't allow change of source/target projects and source branch # after merge request was created - params.except!(:source_project_id) - params.except!(:target_project_id) - params.except!(:source_branch) + params.delete(:source_project_id) + params.delete(:target_project_id) + params.delete(:source_branch) merge_from_quick_action(merge_request) if params[:merge] if merge_request.closed_without_fork? - params.except!(:target_branch, :force_remove_source_branch) + params.delete(:target_branch) + params.delete(:force_remove_source_branch) end if params[:force_remove_source_branch].present? diff --git a/app/services/users/update_service.rb b/app/services/users/update_service.rb index a897e4bd56a..af4fe1aebb9 100644 --- a/app/services/users/update_service.rb +++ b/app/services/users/update_service.rb @@ -16,7 +16,7 @@ module Users user_exists = @user.persisted? - assign_attributes(&block) + assign_attributes if @user.save(validate: validate) && update_status notify_success(user_exists) @@ -48,9 +48,11 @@ module Users success end - def assign_attributes(&block) - if @user.user_synced_attributes_metadata - params.except!(*@user.user_synced_attributes_metadata.read_only_attributes) + def assign_attributes + if (metadata = @user.user_synced_attributes_metadata) + read_only = metadata.read_only_attributes + + params.reject! { |key, _| read_only.include?(key.to_sym) } end @user.assign_attributes(params) if params.any? |