1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 03:23:03 +08:00

Fix system user attempting to show in profile overlay

This commit is contained in:
Dean Herbert 2018-09-13 13:40:46 +09:00
parent 40f7c1bd99
commit 0be3ba946f
3 changed files with 13 additions and 6 deletions

View File

@ -15,11 +15,7 @@ namespace osu.Game.Online.Chat
Timestamp = DateTimeOffset.Now;
Content = message;
Sender = new User
{
Username = @"system",
Colour = @"0000ff",
};
Sender = User.SystemUser;
}
}
}

View File

@ -77,9 +77,11 @@ namespace osu.Game.Overlays
public void ShowUser(User user, bool fetchOnline = true)
{
if (user == User.SystemUser) return;
Show();
if (user.Id == Header?.User.Id)
if (user.Id == Header?.User?.Id)
return;
userReq?.Cancel();

View File

@ -144,5 +144,14 @@ namespace osu.Game.Users
public Badge[] Badges;
public override string ToString() => Username;
/// <summary>
/// A user instance for displaying locally created system messages.
/// </summary>
public static User SystemUser { get; } = new User
{
Username = "system",
Id = 0
};
}
}