Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

nruia-penn
Copy link

@nruia-penn nruia-penn commented Oct 24, 2024

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.

Copy link
Contributor

@Clue88 Clue88 left a 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

@@ -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())
Copy link
Contributor

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

@shiva-menta
Copy link
Contributor

Just made all pennkeys lowercase. Made a test for it, seems to work.

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.

@nruia-penn
Copy link
Author

Do you want me to add comments in the code or in some sort of documentation?

@shiva-menta
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants