Skip to content

Commit

Permalink
Merge pull request #3186 from PanSpagetka/delete-double-checking-rbac
Browse files Browse the repository at this point in the history
Delete unnecessary X.empty? check after calling find_record_with_rbac
  • Loading branch information
martinpovolny committed Jan 10, 2018
2 parents 8dca4f1 + f468658 commit 36a0514
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
3 changes: 0 additions & 3 deletions app/controllers/cloud_subnet_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ def create_finished
def delete_subnets
assert_privileges("cloud_subnet_delete")
subnets = find_records_with_rbac(CloudSubnet, checked_or_params)
if subnets.empty?
add_flash(_("No Cloud Subnet were selected for deletion."), :error)
end

subnets_to_delete = []
subnets.each do |subnet|
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/cloud_volume_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,6 @@ def update_finished
def delete_volumes
assert_privileges("cloud_volume_delete")
volumes = find_records_with_rbac(CloudVolume, checked_or_params)
if volumes.empty?
add_flash(_("No Cloud Volumes were selected for deletion."), :error)
end

volumes_to_delete = []
volumes.each do |volume|
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/ops_controller/settings/schedules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ def schedule_toggle(enable)
_("The selected Schedules were disabled")
end
schedules = find_records_with_rbac(MiqSchedule, checked_or_params)
if schedules.empty?
add_flash(msg, :error)
javascript_flash
end
schedule_enable_disable(schedules, enable) unless schedules.empty?
schedule_enable_disable(schedules, enable)
add_flash(msg, :info, true) unless flash_errors?
schedule_build_list
settings_get_info("st")
Expand Down

0 comments on commit 36a0514

Please sign in to comment.