Reports, and who liked or boosted a post
Another's profile and posts can be reported from the client (/api/v1/reports): a category, words, and for a remote account a copy to its server, which PrivaPub sends from its own actor, never naming the persona. Who liked or boosted a post opens from its card's menu (favourited_by, reblogged_by). e2e: a report from a Mastodon account's profile reaches PrivaPub's moderators forwarded, and a post's likes and boosts list the persona who gave them; the admin helper the tests share moves to Support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
bb68ff8d5e
commit
a0f07abf8c
17 files changed
+410
-16
No files matched your search
@@ -5,6 +5,7 @@ using collAnon.Client.Services;
|
||||
using decePubClient.Extensions;
|
||||
using decePubClient.Models;
|
||||
using decePubClient.Models.Mastodon;
|
||||
using decePubClient.Models.Types;
|
||||
|
||||
using PrivaPub.ClientModels;
|
||||
|
||||
@@ -250,6 +251,22 @@ namespace decePubClient.Services
|
||||
return response.IsSuccessStatusCode ? new WebResult() : await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>Reports an account, with the posts named, to the persona's server's moderators; forwarded, its own server
|
||||
/// gets the report too, from PrivaPub's actor and never naming the persona.</summary>
|
||||
public async Task<WebResult> Report(string accountId, List<string> statusIds, string comment, ReportCategory category, bool forward,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var response = await httpService.Post(APIs.Mastodon.POST_Reports, new ReportRequest
|
||||
{
|
||||
AccountId = accountId,
|
||||
StatusIds = statusIds,
|
||||
Comment = comment?.Trim(),
|
||||
Category = category.ToString().ToLowerInvariant(),
|
||||
Forward = forward
|
||||
}, cancellationToken: cancellationToken);
|
||||
return response.IsSuccessStatusCode ? new WebResult() : await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<WebResult> UnblockDomain(string domain, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var response = await httpService.Delete(APIs.Mastodon.DELETE_DomainBlocks, [$"domain={Uri.EscapeDataString(domain)}"],
|
||||
|
||||
@@ -90,6 +90,20 @@ namespace decePubClient.Services
|
||||
return await response.MastodonReadFromJsonAsync<List<StatusEdit>>(cancellationToken) ?? [];
|
||||
}
|
||||
|
||||
/// <summary>Who liked a post, or boosted it, as far as PrivaPub knows; [] when it cannot be read.</summary>
|
||||
public async Task<List<Account>> InteractedBy(string statusId, bool boosts, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var response = await httpService.Get(boosts ? APIs.Mastodon.GET_M_RebloggedBy(statusId) : APIs.Mastodon.GET_M_FavouritedBy(statusId),
|
||||
["limit=80"], cancellationToken: cancellationToken);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
var failure = await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
await logger.ProcessWarning(failure.ToString(localizer), $"{nameof(StatusService)}.{nameof(InteractedBy)}", cancellationToken);
|
||||
return [];
|
||||
}
|
||||
return await response.MastodonReadFromJsonAsync<List<Account>>(cancellationToken) ?? [];
|
||||
}
|
||||
|
||||
/// <summary>Edits the persona's own post: new words and warning, the media kept; Data is the edited Status.</summary>
|
||||
public async Task<WebResult> Edit(string statusId, ComposeForm form, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user