mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Fix OpenUserProfile
links having multiple argument types
This commit is contained in:
parent
d86424467e
commit
ff17685bc3
@ -74,7 +74,13 @@ namespace osu.Game.Graphics.Containers
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void AddUserLink(IUser user, Action<SpriteText> creationParameters = null)
|
public void AddUserLink(IUser user, Action<SpriteText> creationParameters = null)
|
||||||
=> createLink(CreateChunkFor(user.Username, true, CreateSpriteText, creationParameters), new LinkDetails(LinkAction.OpenUserProfile, user), "view profile");
|
{
|
||||||
|
string argument = user.OnlineID > 1
|
||||||
|
? user.OnlineID.ToString()
|
||||||
|
: user.Username;
|
||||||
|
|
||||||
|
createLink(CreateChunkFor(user.Username, true, CreateSpriteText, creationParameters), new LinkDetails(LinkAction.OpenUserProfile, argument), "view profile");
|
||||||
|
}
|
||||||
|
|
||||||
private void createLink(ITextPart textPart, LinkDetails link, LocalisableString tooltipText, Action action = null)
|
private void createLink(ITextPart textPart, LinkDetails link, LocalisableString tooltipText, Action action = null)
|
||||||
{
|
{
|
||||||
|
@ -446,15 +446,11 @@ namespace osu.Game
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LinkAction.OpenUserProfile:
|
case LinkAction.OpenUserProfile:
|
||||||
if (!(link.Argument is IUser user))
|
var user = int.TryParse(argString, out int userId)
|
||||||
{
|
? new APIUser { Id = userId }
|
||||||
user = int.TryParse(argString, out int userId)
|
: new APIUser { Username = argString };
|
||||||
? new APIUser { Id = userId }
|
|
||||||
: new APIUser { Username = argString };
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowUser(user);
|
ShowUser(user);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LinkAction.OpenWiki:
|
case LinkAction.OpenWiki:
|
||||||
|
Loading…
Reference in New Issue
Block a user