Merge pull request #21707 from Joehuu/fix-comment-actions-casing

Fix some comment actions not being lowercased
This commit is contained in:
Dan Balasescu 2022-12-19 15:31:54 +09:00 committed by GitHub
commit ef7da449b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -77,14 +77,14 @@ namespace osu.Game.Tests.Visual.Online
{ {
var comments = this.ChildrenOfType<DrawableComment>(); var comments = this.ChildrenOfType<DrawableComment>();
var ourComment = comments.SingleOrDefault(x => x.Comment.Id == 1); var ourComment = comments.SingleOrDefault(x => x.Comment.Id == 1);
return ourComment != null && ourComment.ChildrenOfType<OsuSpriteText>().Any(x => x.Text == "Delete"); return ourComment != null && ourComment.ChildrenOfType<OsuSpriteText>().Any(x => x.Text == "delete");
}); });
AddAssert("Second doesn't", () => AddAssert("Second doesn't", () =>
{ {
var comments = this.ChildrenOfType<DrawableComment>(); var comments = this.ChildrenOfType<DrawableComment>();
var ourComment = comments.Single(x => x.Comment.Id == 2); var ourComment = comments.Single(x => x.Comment.Id == 2);
return ourComment.ChildrenOfType<OsuSpriteText>().All(x => x.Text != "Delete"); return ourComment.ChildrenOfType<OsuSpriteText>().All(x => x.Text != "delete");
}); });
} }
@ -102,7 +102,7 @@ namespace osu.Game.Tests.Visual.Online
}); });
AddStep("It has delete button", () => AddStep("It has delete button", () =>
{ {
var btn = ourComment.ChildrenOfType<OsuSpriteText>().Single(x => x.Text == "Delete"); var btn = ourComment.ChildrenOfType<OsuSpriteText>().Single(x => x.Text == "delete");
InputManager.MoveMouseTo(btn); InputManager.MoveMouseTo(btn);
}); });
AddStep("Click delete button", () => AddStep("Click delete button", () =>
@ -175,7 +175,7 @@ namespace osu.Game.Tests.Visual.Online
}); });
AddStep("It has delete button", () => AddStep("It has delete button", () =>
{ {
var btn = ourComment.ChildrenOfType<OsuSpriteText>().Single(x => x.Text == "Delete"); var btn = ourComment.ChildrenOfType<OsuSpriteText>().Single(x => x.Text == "delete");
InputManager.MoveMouseTo(btn); InputManager.MoveMouseTo(btn);
}); });
AddStep("Click delete button", () => AddStep("Click delete button", () =>
@ -245,7 +245,7 @@ namespace osu.Game.Tests.Visual.Online
}); });
AddStep("Click the button", () => AddStep("Click the button", () =>
{ {
var btn = targetComment.ChildrenOfType<OsuSpriteText>().Single(x => x.Text == "Report"); var btn = targetComment.ChildrenOfType<OsuSpriteText>().Single(x => x.Text == "report");
InputManager.MoveMouseTo(btn); InputManager.MoveMouseTo(btn);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
}); });

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
@ -53,7 +54,7 @@ namespace osu.Game.Overlays.Comments
} }
}; };
link.AddLink(UsersStrings.ReportButtonText, this.ShowPopover); link.AddLink(ReportStrings.CommentButton.ToLower(), this.ShowPopover);
} }
private void report(CommentReportReason reason, string comments) private void report(CommentReportReason reason, string comments)

View File

@ -19,6 +19,7 @@ using System;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using System.Collections.Specialized; using System.Collections.Specialized;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -335,7 +336,7 @@ namespace osu.Game.Overlays.Comments
actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10)); actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10));
if (Comment.UserId.HasValue && Comment.UserId.Value == api.LocalUser.Value.Id) if (Comment.UserId.HasValue && Comment.UserId.Value == api.LocalUser.Value.Id)
actionsContainer.AddLink(CommonStrings.ButtonsDelete, deleteComment); actionsContainer.AddLink(CommonStrings.ButtonsDelete.ToLower(), deleteComment);
else else
actionsContainer.AddArbitraryDrawable(new CommentReportButton(Comment)); actionsContainer.AddArbitraryDrawable(new CommentReportButton(Comment));