What
Some checks are pending
/ test-build-and-push (push) Waiting to run

This commit is contained in:
notfire 2025-03-30 22:34:00 -04:00
parent 9c2831ae58
commit d8a4d15beb
Signed by: notfire
GPG key ID: 3AFDACAAB4E56B16

View file

@ -88,16 +88,24 @@ public class AdminController(
[HttpPatch("/api/v1/pleroma/admin/reports")]
[Authenticate("admin:read:reports")]
[ProducesResults(HttpStatusCode.OK)]
public void SetReportState(ReportsQuery query)
public async void SetReportState(ReportsQuery query)
{
try
{
foreach (var list in query.Reports)
{
var report = db.Reports.FirstOrDefault(p => p.Id == list.Id)
var report = await db.Reports.Where(p => p.Id == list.Id).FirstOrDefaultAsync()
?? throw GracefulException.NotFound("Report not found");
report.Resolved = list.State == "closed";
db.SaveChangesAsync();
await db.SaveChangesAsync();
}
}
catch (Exception e)
{
// ReSharper disable once AsyncVoidMethod
throw GracefulException.Conflict(e.ToString());
}
}
}