This commit is contained in:
parent
9c2831ae58
commit
d8a4d15beb
1 changed files with 14 additions and 6 deletions
|
@ -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)
|
||||
{
|
||||
foreach (var list in query.Reports)
|
||||
try
|
||||
{
|
||||
var report = db.Reports.FirstOrDefault(p => p.Id == list.Id)
|
||||
?? throw GracefulException.NotFound("Report not found");
|
||||
foreach (var list in query.Reports)
|
||||
{
|
||||
var report = await db.Reports.Where(p => p.Id == list.Id).FirstOrDefaultAsync()
|
||||
?? throw GracefulException.NotFound("Report not found");
|
||||
|
||||
report.Resolved = list.State == "closed";
|
||||
report.Resolved = list.State == "closed";
|
||||
|
||||
db.SaveChangesAsync();
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// ReSharper disable once AsyncVoidMethod
|
||||
throw GracefulException.Conflict(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue