Skip to content
This repository was archived by the owner on Jul 24, 2020. It is now read-only.

Commit 96c7953

Browse files
committed
Merge pull request #1231 from YaleSTC/1227_tos_bug_52
[1227] [v5.2] Fix broken ToS checkbox handling
2 parents 30e440a + 6999f00 commit 96c7953

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* This file will be updated whenever a new release is put into production.
33
* Any problems should be reported via the "report an issue" link in the footer of the application.
44

5+
## v5.2.2 - 2015-04-20
6+
### Fixed
7+
* Forgetting to check off the ToS checkbox during checkout no longer causes checkout to fail silently ([#1227](https://github.com/YaleSTC/reservations/issues/1227)).
58

69
## v5.2.1 - 2015-04-14
710
### Fixed
@@ -170,6 +173,10 @@
170173
* Replaced Airbrake with Party Foul ([#501](https://github.com/YaleSTC/reservations/issues/501)).
171174
* The first user is now created as a superuser ([#753](https://github.com/YaleSTC/reservations/issues/753)).
172175

176+
## v3.4.10 - 2015-04-20
177+
### Fixed
178+
* Forgetting to check off the ToS checkbox during checkout no longer causes checkout to fail silently ([#1227](https://github.com/YaleSTC/reservations/issues/1227)).
179+
173180
## v3.4.9 - 2015-03-16
174181
### Fixed
175182
* Banned users can no longer have reservations created for them or equipment checked out to them ([#1185](https://github.com/YaleSTC/reservations/issues/1185)).

app/controllers/reservations_controller.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def set_user
1414
@user = User.find(params[:user_id])
1515
return unless @user.role == 'banned'
1616
flash[:error] = 'This user is banned and cannot check out equipment.'
17+
params[:banned] = true
1718
end
1819

1920
def set_reservation
@@ -355,15 +356,19 @@ def upcoming
355356
end
356357

357358
def manage # initializer
358-
redirect_to(root_path) && return unless flash[:error].nil?
359+
if params[:banned] && current_user.view_mode != 'superuser'
360+
redirect_to(root_path) && return
361+
end
359362
@check_out_set = @user.due_for_checkout
360363
@check_in_set = @user.due_for_checkin
361364

362365
render :manage, layout: 'application'
363366
end
364367

365368
def current
366-
redirect_to(root_path) && return unless flash[:error].nil?
369+
if params[:banned] && current_user.view_mode != 'superuser'
370+
redirect_to(root_path) && return
371+
end
367372
@user_overdue_reservations_set =
368373
[Reservation.overdue.for_reserver(@user)].delete_if(&:empty?)
369374
@user_checked_out_today_reservations_set =

0 commit comments

Comments
 (0)