1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge pull request #29637 from Joehuu/collapse-pinned-comment-replies

Hide pinned comment replies initially to match web
This commit is contained in:
Dan Balasescu 2024-08-29 16:21:19 +09:00 committed by GitHub
commit a077acc599
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,7 @@ using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Comments; using osu.Game.Overlays.Comments;
using osu.Game.Overlays.Comments.Buttons;
namespace osu.Game.Tests.Visual.Online namespace osu.Game.Tests.Visual.Online
{ {
@ -58,6 +59,11 @@ namespace osu.Game.Tests.Visual.Online
AddStep("show comments", () => commentsContainer.ShowComments(CommentableType.Beatmapset, 123)); AddStep("show comments", () => commentsContainer.ShowComments(CommentableType.Beatmapset, 123));
AddUntilStep("show more button hidden", AddUntilStep("show more button hidden",
() => commentsContainer.ChildrenOfType<CommentsShowMoreButton>().Single().Alpha == 0); () => commentsContainer.ChildrenOfType<CommentsShowMoreButton>().Single().Alpha == 0);
if (withPinned)
AddAssert("pinned comment replies collapsed", () => commentsContainer.ChildrenOfType<ShowRepliesButton>().First().Expanded.Value, () => Is.False);
else
AddAssert("first comment replies expanded", () => commentsContainer.ChildrenOfType<ShowRepliesButton>().First().Expanded.Value, () => Is.True);
} }
[TestCase(false)] [TestCase(false)]
@ -302,7 +308,7 @@ namespace osu.Game.Tests.Visual.Online
bundle.Comments.Add(new Comment bundle.Comments.Add(new Comment
{ {
Id = 20, Id = 20,
Message = "Reply to pinned comment", Message = "Reply to pinned comment initially hidden",
LegacyName = "AbandonedUser", LegacyName = "AbandonedUser",
CreatedAt = DateTimeOffset.Now, CreatedAt = DateTimeOffset.Now,
VotesCount = 0, VotesCount = 0,

View File

@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Comments
public readonly BindableList<DrawableComment> Replies = new BindableList<DrawableComment>(); public readonly BindableList<DrawableComment> Replies = new BindableList<DrawableComment>();
private readonly BindableBool childrenExpanded = new BindableBool(true); private readonly BindableBool childrenExpanded;
private int currentPage; private int currentPage;
@ -92,6 +92,8 @@ namespace osu.Game.Overlays.Comments
{ {
Comment = comment; Comment = comment;
Meta = meta; Meta = meta;
childrenExpanded = new BindableBool(!comment.Pinned);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]