mirror of
https://github.com/ppy/osu
synced 2025-01-10 08:09:40 +00: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)
|
||||
=> 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)
|
||||
{
|
||||
|
@ -446,15 +446,11 @@ namespace osu.Game
|
||||
break;
|
||||
|
||||
case LinkAction.OpenUserProfile:
|
||||
if (!(link.Argument is IUser user))
|
||||
{
|
||||
user = int.TryParse(argString, out int userId)
|
||||
? new APIUser { Id = userId }
|
||||
: new APIUser { Username = argString };
|
||||
}
|
||||
var user = int.TryParse(argString, out int userId)
|
||||
? new APIUser { Id = userId }
|
||||
: new APIUser { Username = argString };
|
||||
|
||||
ShowUser(user);
|
||||
|
||||
break;
|
||||
|
||||
case LinkAction.OpenWiki:
|
||||
|
Loading…
Reference in New Issue
Block a user