Files
decePubClient/Components/QuotePolicyDialog.razor
T
thepraandClaude Opus 5.5 b8d7858acb
Build / Build (push) Successful in 1m8s
R4 the client catches up: follow requests, followers, downvotes, dismissing, filtering a post, quote policies, statistics in detail
Follow requests answered on the persona's own profile and from the Notifications tab; its followers and the accounts it
follows listed there, a follower removed (asked first). Downvotes on threadiverse posts, after the public-vote notice.
A notification dismissed from its line. "Filter this post" from a card's menu, and the Filters page showing the posts a
filter holds. Who may quote the persona's own posts, and revoking a quote of one. Statistics: a server in detail with
"describe again", the ledger's events, the server's own days. The composer deletes an upload taken out before posting.
MediaType.Documents goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
2026-10-17 04:02:20 +02:00

78 lines
2.6 KiB
Plaintext

@inherits LocalizableComponentBase
@* Who may quote one of the persona's own public or unlisted posts (PUT /api/v1/statuses/:id/interaction_policy,
quote_approval_policy): anyone, its followers or nobody, from the card's menu. The post states its policy in
quote_approval.automatic; PrivaPub tells the post's readers of the change. *@
<DModal Placement="DModalPlacement.ResponsiveBottom" IsOpen="true" IsOpenChanged="Closed" CloseText="@Localizer["Close"]" data-quote-policy-dialog>
<Heading>@Localizer["Who may quote it"]</Heading>
<ChildContent>
<div class="flex flex-col gap-2 mt-3">
@foreach (var policy in Enum.GetValues<QuotePolicy>())
{
<DButton Size="DSize.Sm" class="justify-start" Active="policy == current" Disabled="@(IsDefaultDisabled || isSaving)" OnClick="() => Choose(policy)"
aria-pressed="@(policy == current ? "true" : "false")" data-quote-policy-choice="@StatusService.QuotePolicyValue(policy)">
<i class="@PolicyIcon(policy)" aria-hidden="true"></i>
<span class="flex-1 text-left">@PolicyName(policy)</span>
@if (policy == current)
{
<i class="ion-md-checkmark text-primary" aria-hidden="true"></i>
}
</DButton>
}
</div>
</ChildContent>
</DModal>
@code {
[Inject] StatusService StatusService { get; set; }
[Parameter, EditorRequired] public Status Status { get; set; }
[Parameter] public EventCallback OnClosed { get; set; }
/// <summary>The post as PrivaPub now describes it, its new policy in it.</summary>
[Parameter] public EventCallback<Status> OnChanged { get; set; }
QuotePolicy current = QuotePolicy.Public;
bool isSaving;
protected override void OnInitialized()
{
current = StatusService.QuotePolicyOf(Status);
IsLoading = false;
}
string PolicyName(QuotePolicy policy) => policy switch
{
QuotePolicy.Followers => Localizer["Your followers"],
QuotePolicy.Nobody => Localizer["Nobody"],
_ => Localizer["Anyone"]
};
static string PolicyIcon(QuotePolicy policy) => policy switch
{
QuotePolicy.Followers => "ion-md-people",
QuotePolicy.Nobody => "ion-md-close-circle",
_ => "ion-md-globe"
};
async Task Choose(QuotePolicy policy)
{
if (policy == current)
return;
isSaving = true;
var result = await StatusService.SetQuotePolicy(Status.Id, policy);
isSaving = false;
if (result.IsInvalid)
{
Toast.AddResponseError(result);
return;
}
var updated = (Status)result.Data;
current = StatusService.QuotePolicyOf(updated);
Toast.AddResponseSuccess(Localizer["Saved."]);
await OnChanged.InvokeAsync(updated);
}
Task Closed(bool open) => open ? Task.CompletedTask : OnClosed.InvokeAsync();
}