fix: correct link to user profile in user-card#634
Closed
Satont wants to merge 1 commit into
Closed
Conversation
If we located in `Stream Manager` and opening user card, with origin we going to `dashboard.twitch.tv/{username}`, which is wrong link.
So, i hardcoded twitch url to correctly handle this.
I'm not sure does this component used by youtube, if yes tell me i'll add checks for site address in this function.
AnatoleAM
suggested changes
May 27, 2023
|
|
||
| function getProfileURL(): string { | ||
| return window.location.origin + "/" + props.target.username; | ||
| return "https://www.twitch.tv/" + props.target.username; |
Contributor
There was a problem hiding this comment.
This shouldn't be hardcoded, as there is no guarantee the current origin is twitch.tv. Use location data instead.
There was a problem hiding this comment.
This shouldn't be hardcoded, as there is no guarantee the current origin is
twitch.tv. Use location data instead.
I propose this solution to the problem
function getLocationOrigin(): string {
if (location.hostname.includes("dashboard")) {
return "https://www.twitch.tv/";
}
return location.origin;
}You can also fix it here as well
Contributor
There was a problem hiding this comment.
There is no reason to hardcode this, use a regular expression instead
Contributor
|
Closing as stale. If fixes are made open a new pull request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If we located in
Stream Managerand opening user card, with origin we going todashboard.twitch.tv/{username}, which is wrong link.So, i hardcoded twitch url to correctly handle this.
I'm not sure does this component used by youtube, if yes tell me i'll add checks for site address in this function.