Fix "Follow" button not changing to "Unfollow" #316
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
You can change the case in the URL, and the sidebar will match it:
If I try to follow this user, the "Follow" button doesn't change to "Unfollow". Going into the settings page reveals why:
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:And after following:
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.