1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-20 05:19:55 +08:00
Files
osu-lazer/osu.Game/Overlays/Chat/ReportChatPopover.cs
T
Bartłomiej Dach 032912e62b Adjust message on successful report to match bancho
Addresses https://github.com/ppy/osu/discussions/36004.

Not adding localisation because the previous implementation was
`.ToString()`ing anyway.

Would have made the abuse e-mail a link but `mailto:` doesn't work with
`MessageFormatter` and I don't want to go into that right now.

The message *almost* matches stable. The "almost" is because it doesn't
mention the `/ignore` chat command. I was just going to implement the
command, but I went to check what it does, and backed away slowly
because it has like weird scoping to chat, highlights, and PMs, so
`nope.avi`.
2025-12-16 11:20:54 +01:00

62 lines
2.4 KiB
C#

// 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.
using osu.Framework.Allocation;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.Chat;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Chat
{
public partial class ReportChatPopover : ReportPopover<ChatReportReason>
{
[Resolved]
private IAPIProvider api { get; set; } = null!;
[Resolved]
private ChannelManager channelManager { get; set; } = null!;
private readonly Message message;
public ReportChatPopover(Message message)
: base(ReportStrings.UserTitle(message.Sender?.Username ?? @"Someone"))
{
this.message = message;
Action = report;
}
protected override bool IsCommentRequired(ChatReportReason reason) => reason == ChatReportReason.Other;
private void report(ChatReportReason reason, string comments)
{
var request = new ChatReportRequest(message.Id, reason, comments);
request.Success += () =>
{
string thanksMessage;
switch (channelManager.CurrentChannel.Value.Type)
{
case ChannelType.PM:
thanksMessage = """
Chat moderators have been alerted. You have reported a private message so they will not be able to read history to maintain your privacy. Please make sure to include as much details as you can.
You can submit a second report with more details if required, or contact abuse@ppy.sh if a user is being extremely offensive.
You can also block a user via the block button on their user profile, or by right-clicking on their name in the chat and selecting "Block".
""";
break;
default:
thanksMessage = @"Chat moderators have been alerted. Thanks for your help.";
break;
}
channelManager.CurrentChannel.Value.AddNewMessages(new InfoMessage(thanksMessage));
};
api.Queue(request);
}
}
}