cicscareers / 320-S20-Track1

Integration Track 1
BSD 3-Clause "New" or "Revised" License
11 stars 3 forks source link

Prevent past appointments #384

Closed ishchhabra closed 4 years ago

ishchhabra commented 4 years ago

In this branch, I have made some changes in frontend so that when a user tries to go to yesterday or before that, we display an alert (in frontend). Although the user can't now ask from the frontend, to handle malicious requests, if backend receives a request with date before today, it just straightaway changes it to today.

For now, I have created a lambda function "test_get_supporters_before_match" in AWS which could be used to test the backend part. Once this pull request is approved, that could be deleted and changes applied to the main get_supporters_before_match.

ishchhabra commented 4 years ago

I have requested merge into master because this pull request has parts of both frontend and backend.

ishchhabra commented 4 years ago

I have done some basic changes to make the alert look as better as I could. I do not have much experience with frontend UX design, I would ask someone else to style the alert further if more changes are needed.

ishchhabra commented 4 years ago

Hey @powellsl99, I have split the PR into 2, one for frontend changes and one for backend since the changes for backend don't affect the frontend (the frontend could function even without those changes). Also, I had disabled time chips from earlier time of the day, as you had asked.

powellsl99 commented 4 years ago

@ishchhabra I think this accidentally made them disabled before the current time for every day rather than just the current day. I think it would be good to if rather than disabled they should just be not rendered as well. So maybe we pass the currently displayed date into generateTimeChip() and if it is the same as today and the time in minutes < current time you just break and dont generate the chip

ishchhabra commented 4 years ago

Hey @powellsl99, There was just a small bug that I just fixed. Could you please review it now? My idea behind showing disabled time chips was that usually supporters have recurring appointment blocks and so if the time suits the student, he might potentially search for the same time next week.

powellsl99 commented 4 years ago

Hey @powellsl99, There was just a small bug that I just fixed. Could you please review it now? My idea behind showing disabled time chips was that usually supporters have recurring appointment blocks and so if the time suits the student, he might potentially search for the same time next week.

Fair enough, we'll merge in for now and if we ever wanna change it we always can!