Skip to content

fix: correct link to user profile in user-card#634

Closed
Satont wants to merge 1 commit into
SevenTV:masterfrom
Satont:patch-1
Closed

fix: correct link to user profile in user-card#634
Satont wants to merge 1 commit into
SevenTV:masterfrom
Satont:patch-1

Conversation

@Satont
Copy link
Copy Markdown

@Satont Satont commented May 24, 2023

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.

@Satont Satont changed the title fix: correct link to user profile fix: correct link to user profile in user-card May 24, 2023
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.
Comment thread src/app/chat/UserCard.vue

function getProfileURL(): string {
return window.location.origin + "/" + props.target.username;
return "https://www.twitch.tv/" + props.target.username;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be hardcoded, as there is no guarantee the current origin is twitch.tv. Use location data instead.

Copy link
Copy Markdown

@crashmax-dev crashmax-dev May 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

owner.url = `https://twitch.tv/${emote.owner?.login}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason to hardcode this, use a regular expression instead

@AnatoleAM
Copy link
Copy Markdown
Contributor

Closing as stale. If fixes are made open a new pull request

@AnatoleAM AnatoleAM closed this Jun 26, 2023
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.

3 participants