Build / Build (push) Successful in 1m3s
A singleton ServerSettings (title, descriptions, contact, thumbnail, privacy policy, terms, rules, relays, media overrides, PublishActivity), cached by InstanceSettings and read by the instance API, NodeInfo, the instance actor, the web pages and the mailer; its defaults are the old literals, so nothing changes until an administrator edits. /clientapi/admin/settings (and /thumbnail), /announcements, /relays for administrators; /clientapi/moderator/log, the staff's log (AdminAction, written by domain blocks, backups, settings and the CLI; no IP, never a root paired with its personas). The Mastodon API's rules, extended description, privacy policy, terms of service, domain blocks (Published, Obfuscate), announcements (dismiss, reactions, streaming) and activity (only when published). Reports carry rule ids. Media overrides clamped to hard caps. Relays named by the settings reconcile next to the configured ones. Verified: interop.sh instance accounts relay with mastodon, relay, aoderelay and mailpit, 119 passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using PrivaPub.Api.Mastodon.Infrastructure;
|
|
using PrivaPub.Api.Mastodon.Mappers;
|
|
using PrivaPub.Domain.Relationships;
|
|
|
|
namespace PrivaPub.Api.Mastodon.Controllers
|
|
{
|
|
public class ReportsController : MastodonController
|
|
{
|
|
readonly IReportService _reports;
|
|
readonly MastodonMapper _mapper;
|
|
|
|
public ReportsController(IReportService reports, MastodonMapper mapper)
|
|
{
|
|
_reports = reports;
|
|
_mapper = mapper;
|
|
}
|
|
|
|
[HttpPost("/api/v1/reports"), Scope("write:reports")]
|
|
public async Task<IActionResult> Create(CancellationToken token)
|
|
{
|
|
var report = await _reports.File(Me, Params.Get("account_id"), Params.List("status_ids"), Params.Get("comment"), Params.Get("category"),
|
|
Params.List("rule_ids"), Params.Bool("forward") == true, token);
|
|
if (report == default)
|
|
return NotFoundError();
|
|
return Json(new
|
|
{
|
|
id = report.ID,
|
|
action_taken = false,
|
|
action_taken_at = default(string),
|
|
category = report.Category,
|
|
comment = report.Comment ?? string.Empty,
|
|
forwarded = report.Forwarded,
|
|
created_at = MastodonJson.Time(report.CreatedAt),
|
|
status_ids = report.PostIds,
|
|
rule_ids = report.RuleIds,
|
|
target_account = await _mapper.Account(report.TargetAccountId, token)
|
|
});
|
|
}
|
|
}
|
|
}
|