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

Fix "Follow" button not changing to "Unfollow" #316

Merged
merged 1 commit into from Nov 15, 2021

Conversation

ClockVapor
Copy link
Contributor

@ClockVapor ClockVapor commented Nov 12, 2021

Currently, case sensitivity is broken when following a user. For example:

Notice how the URL contains "SPEZ" in all caps, and so does the "u/SPEZ" part on the right:
Screen Shot 2021-11-12 at 4 19 08 PM

You can change the case in the URL, and the sidebar will match it:
Screen Shot 2021-11-12 at 4 19 21 PM

If I try to follow this user, the "Follow" button doesn't change to "Unfollow". Going into the settings page reveals why:
Screen Shot 2021-11-12 at 4 23 01 PM

The case of the subscribed user and the case of the username in the URL don't match.

This PR fixes this by using the fetched username in the User struct instead of the provided name which can have arbitrary casing. With the fix applied:
Screen Shot 2021-11-12 at 5 51 04 PM

And after following:
Screen Shot 2021-11-12 at 5 51 17 PM

Note: This is only really an issue if you manually type in a user's URL with incorrect casing. If you click a link to a user's profile instead, the URL will have the correct casing, and so the user added to the subscriptions list will also have the correct casing.

@spikecodes spikecodes merged commit 2486347 into libreddit:master Nov 15, 2021
@spikecodes
Copy link
Collaborator

Thank you for this PR!

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

Successfully merging this pull request may close these issues.

None yet

2 participants