Merge pull request #3419 from peppy/fix-system-user

Fix system user attempting to show in profile overlay
This commit is contained in:
Dean Herbert 2018-09-14 18:46:22 +09:00 committed by GitHub
commit ccabad60fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.SYSTEM_USER;
}
}
}

View File

@ -77,9 +77,11 @@ namespace osu.Game.Overlays
public void ShowUser(User user, bool fetchOnline = true)
{
if (user == User.SYSTEM_USER) 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 readonly User SYSTEM_USER = new User
{
Username = "system",
Id = 0
};
}
}