Skip to content

Commit ed143fa

Browse files
committed
Fix lint errors
1 parent 7575e29 commit ed143fa

15 files changed

Lines changed: 40 additions & 44 deletions

app/controllers/admin/users_controller.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def update
2424
redirect_to admin_users_path
2525
else
2626
flash[:error] = "Something didn't work quite right -- try again?"
27-
redirect_back(fallback_location: edit_admin_user_path)
27+
redirect_back_or_to(edit_admin_user_path)
2828
end
2929
end
3030

@@ -81,23 +81,23 @@ def add_role
8181
resource_type: params[:resource_type],
8282
resource_id: params[:resource_id])
8383
rescue => e
84-
redirect_back(fallback_location: admin_users_path, alert: e.message)
84+
redirect_back_or_to(admin_users_path, alert: e.message)
8585
return
8686
end
87-
redirect_back(fallback_location: admin_users_path, notice: "Role added!")
87+
redirect_back_or_to(admin_users_path, notice: "Role added!")
8888
end
8989

9090
def resend_invitation
9191
user = User.find(params[:user_id])
9292
user.invite!
93-
redirect_back(fallback_location: admin_users_path, notice: "#{user.name} reinvited!")
93+
redirect_back_or_to(admin_users_path, notice: "#{user.name} reinvited!")
9494
end
9595

9696
def remove_role
9797
RemoveRoleService.call(user_id: params[:user_id], role_id: params[:role_id])
98-
redirect_back(fallback_location: admin_users_path, notice: "Role removed!")
98+
redirect_back_or_to(admin_users_path, notice: "Role removed!")
9999
rescue => e
100-
redirect_back(fallback_location: admin_users_path, alert: e.message)
100+
redirect_back_or_to(admin_users_path, alert: e.message)
101101
end
102102

103103
private

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ApplicationController < ActionController::Base
1919

2020
def session_expired
2121
flash[:error] = "Your session expired. This could be due to leaving a page open for a long time, or having multiple tabs open. Try resubmitting."
22-
redirect_back fallback_location: root_path
22+
redirect_back_or_to(root_path)
2323
end
2424

2525
def current_organization

app/controllers/attachments_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ class AttachmentsController < ApplicationController
22
def destroy
33
ActiveStorage::Attachment.find(params[:id])&.purge
44

5-
redirect_back fallback_location: partners_path
5+
redirect_back_or_to(partners_path)
66
end
77
end

app/controllers/audits_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def finalize
3232
@audit.finalized!
3333
redirect_to audit_path(@audit), notice: "Audit is Finalized."
3434
rescue => e
35-
redirect_back(fallback_location: audits_path, alert: "Could not finalize audit: #{e.message}")
35+
redirect_back_or_to(audits_path, alert: "Could not finalize audit: #{e.message}")
3636
end
3737

3838
def update

app/controllers/concerns/importable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def import_csv
3939
else
4040
flash[:error] = "No file was attached!"
4141
end
42-
redirect_back(fallback_location: { action: :index, organization_id: current_organization })
42+
redirect_back_or_to({ action: :index, organization_id: current_organization })
4343
end
4444

4545
private

app/controllers/distributions_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def picked_up
272272
flash[:error] = 'Sorry, we encountered an error when trying to mark this distribution as being completed'
273273
end
274274

275-
redirect_back(fallback_location: distribution_path)
275+
redirect_back_or_to(distribution_path)
276276
end
277277

278278
def pickup_day

app/controllers/donation_sites_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def create
2626
else
2727
flash.now[:error] = "Something didn't work quite right -- try again?"
2828
if request.format.turbo_stream?
29-
format.html { render partial: "donation_sites/new_modal", status: :unprocessable_entity }
29+
format.html { render partial: "donation_sites/new_modal", status: :unprocessable_content }
3030
end
3131

3232
format.html do
@@ -69,7 +69,7 @@ def deactivate
6969
donation_site.deactivate!
7070
rescue => e
7171
flash[:error] = e.message
72-
redirect_back(fallback_location: donation_sites_path)
72+
redirect_back_or_to(donation_sites_path)
7373
return
7474
end
7575

@@ -83,7 +83,7 @@ def reactivate
8383
donation_site.reactivate!
8484
rescue => e
8585
flash[:error] = e.message
86-
redirect_back(fallback_location: donation_sites_path)
86+
redirect_back_or_to(donation_sites_path)
8787
return
8888
end
8989

app/controllers/items_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def deactivate
9595
item.deactivate!
9696
rescue => e
9797
flash[:error] = e.message
98-
redirect_back(fallback_location: items_path)
98+
redirect_back_or_to(items_path)
9999
return
100100
end
101101

@@ -108,7 +108,7 @@ def destroy
108108
item.destroy
109109
if item.errors.any?
110110
flash[:error] = item.errors.full_messages.join("\n")
111-
redirect_back(fallback_location: items_path)
111+
redirect_back_or_to(items_path)
112112
return
113113
end
114114

app/controllers/kits_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ def create
4646
def deactivate
4747
@kit = current_organization.kits.find(params[:id])
4848
@kit.deactivate
49-
redirect_back(fallback_location: dashboard_path, notice: "Kit has been deactivated!")
49+
redirect_back_or_to(dashboard_path, notice: "Kit has been deactivated!")
5050
end
5151

5252
def reactivate
5353
@kit = current_organization.kits.find(params[:id])
5454
if @kit.can_reactivate?
5555
@kit.reactivate
56-
redirect_back(fallback_location: dashboard_path, notice: "Kit has been reactivated!")
56+
redirect_back_or_to(dashboard_path, notice: "Kit has been reactivated!")
5757
else
58-
redirect_back(fallback_location: dashboard_path, alert: "Cannot reactivate kit - it has inactive items! Please reactivate the items first.")
58+
redirect_back_or_to(dashboard_path, alert: "Cannot reactivate kit - it has inactive items! Please reactivate the items first.")
5959
end
6060
end
6161

app/controllers/organizations_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def promote_to_org_admin
5151
resource_id: current_organization.id)
5252
redirect_to user_update_redirect_path, notice: "User has been promoted!"
5353
rescue => e
54-
redirect_back(fallback_location: organization_path, alert: e.message)
54+
redirect_back_or_to(organization_path, alert: e.message)
5555
end
5656
end
5757

@@ -64,7 +64,7 @@ def demote_to_user
6464
resource_id: current_organization.id)
6565
redirect_to user_update_redirect_path, notice: "User has been demoted!"
6666
rescue => e
67-
redirect_back(fallback_location: organization_path, alert: e.message)
67+
redirect_back_or_to(organization_path, alert: e.message)
6868
end
6969
end
7070

@@ -77,7 +77,7 @@ def remove_user
7777
resource_id: current_organization.id)
7878
redirect_to user_update_redirect_path, notice: "User has been removed!"
7979
rescue => e
80-
redirect_back(fallback_location: organization_path, alert: e.message)
80+
redirect_back_or_to(organization_path, alert: e.message)
8181
end
8282
end
8383

0 commit comments

Comments
 (0)