Skip to content

Commit

Permalink
Merge pull request #29637 from Joehuu/collapse-pinned-comment-replies
Browse files Browse the repository at this point in the history
Hide pinned comment replies initially to match web
  • Loading branch information
smoogipoo authored Aug 29, 2024
2 parents d49cd71 + ef443b0 commit a077acc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Comments;
using osu.Game.Overlays.Comments.Buttons;

namespace osu.Game.Tests.Visual.Online
{
Expand Down Expand Up @@ -58,6 +59,11 @@ public void TestSingleCommentsPage(bool withPinned)
AddStep("show comments", () => commentsContainer.ShowComments(CommentableType.Beatmapset, 123));
AddUntilStep("show more button hidden",
() => 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)]
Expand Down Expand Up @@ -302,7 +308,7 @@ private static CommentBundle getExampleComments(bool withPinned = false)
bundle.Comments.Add(new Comment
{
Id = 20,
Message = "Reply to pinned comment",
Message = "Reply to pinned comment initially hidden",
LegacyName = "AbandonedUser",
CreatedAt = DateTimeOffset.Now,
VotesCount = 0,
Expand Down
4 changes: 3 additions & 1 deletion osu.Game/Overlays/Comments/DrawableComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public partial class DrawableComment : CompositeDrawable

public readonly BindableList<DrawableComment> Replies = new BindableList<DrawableComment>();

private readonly BindableBool childrenExpanded = new BindableBool(true);
private readonly BindableBool childrenExpanded;

private int currentPage;

Expand Down Expand Up @@ -92,6 +92,8 @@ public DrawableComment(Comment comment, IReadOnlyList<CommentableMeta> meta)
{
Comment = comment;
Meta = meta;

childrenExpanded = new BindableBool(!comment.Pinned);
}

[BackgroundDependencyLoader]
Expand Down

0 comments on commit a077acc

Please sign in to comment.