mirror of
https://github.com/ppy/osu.git
synced 2026-05-17 02:22:35 +08:00
2006485d60
This PR refactors the report popover to have an optional confirmation message after completing the request. This was initially meant for #32584, but then I realized I can first test it out on the user profiles, so I've implemented it here as well. Can be reviewed commit by commit. https://github.com/user-attachments/assets/cd59c560-c824-4a5e-bab6-5ecbf5125af1 --------- Co-authored-by: Dean Herbert <pe@ppy.sh>
39 lines
1.1 KiB
C#
39 lines
1.1 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 System.Net.Http;
|
|
using osu.Framework.IO.Network;
|
|
using osu.Game.Overlays.Profile;
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
{
|
|
public class UserReportRequest : APIRequest
|
|
{
|
|
public readonly int UserID;
|
|
public readonly UserReportReason Reason;
|
|
public readonly string Comment;
|
|
|
|
public UserReportRequest(int userID, UserReportReason reason, string comment)
|
|
{
|
|
UserID = userID;
|
|
Reason = reason;
|
|
Comment = comment;
|
|
}
|
|
|
|
protected override WebRequest CreateWebRequest()
|
|
{
|
|
var request = base.CreateWebRequest();
|
|
request.Method = HttpMethod.Post;
|
|
|
|
request.AddParameter(@"reportable_type", @"user");
|
|
request.AddParameter(@"reportable_id", $"{UserID}");
|
|
request.AddParameter(@"reason", Reason.ToString());
|
|
request.AddParameter(@"comments", Comment);
|
|
|
|
return request;
|
|
}
|
|
|
|
protected override string Target => @"reports";
|
|
}
|
|
}
|