-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
made pennkeys lowercase and changed test case #680
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Left a comment for some edge cases
backend/courses/views.py
Outdated
@@ -520,7 +520,8 @@ def get_all_friendships(self): | |||
|
|||
def post(self, request): | |||
sender = request.user | |||
recipient = get_object_or_404(User, username=request.data.get("pennkey")) | |||
|
|||
recipient = get_object_or_404(User, username=request.data.get("pennkey").lower()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably build in some logic here to handle the case where request.data.get("pennkey")
returns None
; this probably shouldn't happen based on input validation but we wouldn't want this to crash because of NoneType exception. (same with the other case that you modified)
You might also want to add some tests for unexpected inputs if they're not already there
Would also be great to add 1-2 sentences on why this is needed! It's helpful to have more documentation on why we're making changes. |
Do you want me to add comments in the code or in some sort of documentation? |
Just within the PR itself would be sufficient. Something like this. |
Made it so when people send friend requests on penn courses, it changes the username to all lowercase so that when people add friends and accidentally capitalize the first letter it still is able to find the friend they are looking for.