Skip to content

Commit

Permalink
Merge pull request #3419 from peppy/fix-system-user
Browse files Browse the repository at this point in the history
Fix system user attempting to show in profile overlay
  • Loading branch information
peppy committed Sep 14, 2018
2 parents bf10561 + a1328fb commit ccabad6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 1 addition & 5 deletions osu.Game/Online/Chat/InfoMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ public InfoMessage(string message) : base(infoID--)
Timestamp = DateTimeOffset.Now;
Content = message;

Sender = new User
{
Username = @"system",
Colour = @"0000ff",
};
Sender = User.SYSTEM_USER;
}
}
}
4 changes: 3 additions & 1 deletion osu.Game/Overlays/UserProfileOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ protected override void PopOut()

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();
Expand Down
9 changes: 9 additions & 0 deletions osu.Game/Users/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,14 @@ public class RankHistoryData
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
};
}
}

0 comments on commit ccabad6

Please sign in to comment.