Add grief report webhook, add ability to link to individual reports

This commit is contained in:
jvyden 2022-07-27 00:11:15 -04:00
parent 2dcf8dd390
commit 6ca81e0421
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
9 changed files with 317 additions and 212 deletions

View file

@ -2,6 +2,7 @@
using System.Text.Json;
using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Administration.Reports;
using LBPUnion.ProjectLighthouse.Configuration;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
using LBPUnion.ProjectLighthouse.Types;
@ -45,6 +46,13 @@ public class ReportController : ControllerBase
this.database.Reports.Add(report);
await this.database.SaveChangesAsync();
await WebhookHelper.SendWebhook(
title: "New grief report",
description: $"Submitted by {user.Username}\n" +
$"To view it, click [here]({ServerConfiguration.Instance.ExternalUrl}/admin/report/{report.ReportId}).",
dest: WebhookHelper.WebhookDestination.Moderation
);
return this.Ok();
}