2019-10-07 21:48:05 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests.Responses
|
|
|
|
|
{
|
2019-10-09 00:22:23 +08:00
|
|
|
|
public class APICommentsController
|
2019-10-07 21:48:05 +08:00
|
|
|
|
{
|
2019-10-08 20:39:03 +08:00
|
|
|
|
private List<Comment> comments;
|
|
|
|
|
|
2019-10-07 21:48:05 +08:00
|
|
|
|
[JsonProperty(@"comments")]
|
2019-10-08 20:39:03 +08:00
|
|
|
|
public List<Comment> Comments
|
|
|
|
|
{
|
|
|
|
|
get => comments;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
comments = value;
|
|
|
|
|
comments.ForEach(child =>
|
|
|
|
|
{
|
|
|
|
|
if (child.ParentId != null)
|
|
|
|
|
{
|
|
|
|
|
comments.ForEach(parent =>
|
|
|
|
|
{
|
|
|
|
|
if (parent.Id == child.ParentId)
|
2019-10-09 00:09:02 +08:00
|
|
|
|
{
|
2019-10-08 20:39:03 +08:00
|
|
|
|
parent.ChildComments.Add(child);
|
2019-10-09 00:09:02 +08:00
|
|
|
|
child.ParentComment = parent;
|
|
|
|
|
}
|
2019-10-08 20:39:03 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-07 21:48:05 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"has_more")]
|
|
|
|
|
public bool HasMore { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"has_more_id")]
|
2019-10-07 23:26:07 +08:00
|
|
|
|
public long? HasMoreId { get; set; }
|
2019-10-07 21:48:05 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"user_follow")]
|
|
|
|
|
public bool UserFollow { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"included_comments")]
|
|
|
|
|
public List<Comment> IncludedComments { get; set; }
|
|
|
|
|
|
2019-10-08 18:45:13 +08:00
|
|
|
|
private List<User> users;
|
|
|
|
|
|
2019-10-07 21:48:05 +08:00
|
|
|
|
[JsonProperty(@"users")]
|
2019-10-08 18:45:13 +08:00
|
|
|
|
public List<User> Users
|
|
|
|
|
{
|
|
|
|
|
get => users;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
users = value;
|
|
|
|
|
|
|
|
|
|
value.ForEach(u =>
|
|
|
|
|
{
|
|
|
|
|
Comments.ForEach(c =>
|
|
|
|
|
{
|
|
|
|
|
if (c.UserId == u.Id)
|
|
|
|
|
c.User = u;
|
2019-10-09 16:32:17 +08:00
|
|
|
|
|
|
|
|
|
if (c.EditedById == u.Id)
|
|
|
|
|
c.EditedUser = u;
|
2019-10-08 18:45:13 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-07 21:48:05 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"total")]
|
|
|
|
|
public int Total { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"top_level_count")]
|
|
|
|
|
public int TopLevelCount { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|