Add a User property to the comment for easy access

This commit is contained in:
Andrei Zavatski
2019-10-08 13:45:13 +03:00
parent 275648ee4f
commit 801b5b474e
3 changed files with 42 additions and 3 deletions

View File

@ -24,8 +24,26 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"included_comments")]
public List<Comment> IncludedComments { get; set; }
private List<User> users;
[JsonProperty(@"users")]
public List<User> Users { get; set; }
public List<User> Users
{
get => users;
set
{
users = value;
value.ForEach(u =>
{
Comments.ForEach(c =>
{
if (c.UserId == u.Id)
c.User = u;
});
});
}
}
[JsonProperty(@"total")]
public int Total { get; set; }

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using Newtonsoft.Json;
using osu.Game.Users;
using System;
namespace osu.Game.Online.API.Requests.Responses
@ -27,6 +28,8 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"user_id")]
public long UserId { get; set; }
public User User { get; set; }
[JsonProperty(@"message")]
public string Message { get; set; }