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.
|
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-10-07 21:48:05 +08:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.Collections.Generic;
|
2021-08-13 20:22:46 +08:00
|
|
|
|
using System.Linq;
|
2019-10-07 21:48:05 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests.Responses
|
|
|
|
|
{
|
2019-10-15 16:20:06 +08:00
|
|
|
|
public class CommentBundle
|
2019-10-07 21:48:05 +08:00
|
|
|
|
{
|
|
|
|
|
[JsonProperty(@"comments")]
|
2020-02-10 20:43:11 +08:00
|
|
|
|
public List<Comment> Comments { get; set; }
|
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; }
|
|
|
|
|
|
2021-08-13 14:13:28 +08:00
|
|
|
|
[JsonProperty(@"pinned_comments")]
|
|
|
|
|
public List<Comment> PinnedComments { get; set; }
|
|
|
|
|
|
2020-01-29 11:44:39 +08:00
|
|
|
|
private List<long> userVotes;
|
|
|
|
|
|
2019-10-17 17:35:12 +08:00
|
|
|
|
[JsonProperty(@"user_votes")]
|
2020-01-29 11:44:39 +08:00
|
|
|
|
public List<long> UserVotes
|
2019-10-17 17:35:12 +08:00
|
|
|
|
{
|
2020-01-29 11:44:39 +08:00
|
|
|
|
get => userVotes;
|
|
|
|
|
set
|
2019-10-17 17:35:12 +08:00
|
|
|
|
{
|
2020-01-29 11:44:39 +08:00
|
|
|
|
userVotes = value;
|
|
|
|
|
|
2020-01-30 05:53:05 +08:00
|
|
|
|
Comments.ForEach(c => c.IsVoted = value.Contains(c.Id));
|
2020-02-21 17:41:03 +08:00
|
|
|
|
IncludedComments.ForEach(c => c.IsVoted = value.Contains(c.Id));
|
2020-01-29 11:44:39 +08:00
|
|
|
|
}
|
2019-10-17 17:35:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-04 17:02:44 +08:00
|
|
|
|
private List<APIUser> users;
|
2019-10-08 18:45:13 +08:00
|
|
|
|
|
2019-10-07 21:48:05 +08:00
|
|
|
|
[JsonProperty(@"users")]
|
2021-11-04 17:02:44 +08:00
|
|
|
|
public List<APIUser> Users
|
2019-10-08 18:45:13 +08:00
|
|
|
|
{
|
|
|
|
|
get => users;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
users = value;
|
|
|
|
|
|
2021-08-13 20:22:46 +08:00
|
|
|
|
foreach (var user in value)
|
2019-10-08 18:45:13 +08:00
|
|
|
|
{
|
2021-08-13 20:22:46 +08:00
|
|
|
|
foreach (var comment in Comments.Concat(IncludedComments).Concat(PinnedComments))
|
2019-10-08 18:45:13 +08:00
|
|
|
|
{
|
2021-08-13 20:22:46 +08:00
|
|
|
|
if (comment.UserId == user.Id)
|
|
|
|
|
comment.User = user;
|
2019-10-09 16:32:17 +08:00
|
|
|
|
|
2021-08-13 20:22:46 +08:00
|
|
|
|
if (comment.EditedById == user.Id)
|
|
|
|
|
comment.EditedUser = user;
|
|
|
|
|
}
|
|
|
|
|
}
|
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; }
|
|
|
|
|
}
|
|
|
|
|
}
|