1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 16:32:54 +08:00

Handle edited comments

This commit is contained in:
Andrei Zavatski 2019-10-09 11:32:17 +03:00
parent a0dfbfe148
commit ad99a3236f
3 changed files with 18 additions and 1 deletions

View File

@ -63,6 +63,9 @@ namespace osu.Game.Online.API.Requests.Responses
{ {
if (c.UserId == u.Id) if (c.UserId == u.Id)
c.User = u; c.User = u;
if (c.EditedById == u.Id)
c.EditedUser = u;
}); });
}); });
} }

View File

@ -81,6 +81,8 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"edited_by_id")] [JsonProperty(@"edited_by_id")]
public long? EditedById { get; set; } public long? EditedById { get; set; }
public User EditedUser { get; set; }
public bool IsTopLevel { get; set; } public bool IsTopLevel { get; set; }
public bool IsDeleted { get; set; } public bool IsDeleted { get; set; }

View File

@ -35,6 +35,7 @@ namespace osu.Game.Overlays.Comments
{ {
LinkFlowContainer username; LinkFlowContainer username;
FillFlowContainer childCommentsContainer; FillFlowContainer childCommentsContainer;
FillFlowContainer info;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
@ -140,7 +141,7 @@ namespace osu.Game.Overlays.Comments
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new FillFlowContainer info = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
@ -188,6 +189,17 @@ namespace osu.Game.Overlays.Comments
username.AddUserLink(comment.User); username.AddUserLink(comment.User);
} }
if (comment.EditedAt.HasValue)
{
info.Add(new SpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 12),
Text = $@"edited {HumanizerUtils.Humanize(comment.EditedAt.Value)} by {comment.EditedUser.Username}"
});
}
comment.ChildComments.ForEach(c => comment.ChildComments.ForEach(c =>
{ {
if (!c.IsDeleted) if (!c.IsDeleted)