R8 the Mastodon API made real in decePub: featured tags, notify, languages, recommendations, notes, suggestions, the direct stream

A profile shows the hashtags an account features as chips opening their feed; under another account's header is what the
persona keeps of it for itself alone: for one it follows, a bell (follow with notify), the languages of its posts that
reach the home feed (follow with languages[]) and Recommend (endorsements, private here), and for any account a private
note saved on blur or with Save. Settings edits the persona's featured hashtags (added by name or from those used lately,
10 at most) and its reading preferences (/clientapi/avatar/private/preferences), which CascadingState keeps per persona
and the card applies to sensitive media and content warnings. A hashtag's tab features it on the profile. Explore has Who
to follow (/api/v2/suggestions, dismissed for good after asking); Administration has Staff picks. The Direct tab follows
the direct stream's conversation events; status notifications show the post. The follows CSV carries notify and languages.

Verified: Release build, 0 errors (the 3 warnings were there before). Not run against PrivaPub or in the pasture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-10-18 08:58:30 +02:00
1 parent 566b0e33ea
commit d33697e3fc
28 files changed
+1784 -52

No files matched your search

@@ -166,6 +166,8 @@
"persona.delete" => Localizer["Persona deleted"],
"group.delete" => Localizer["Group deleted"],
"post.remove" => Localizer["Post removed"],
"staff_pick.insert" => Localizer["Account picked by the staff"],
"staff_pick.delete" => Localizer["Staff pick removed"],
_ => action
};
}
+165
View File
@@ -0,0 +1,165 @@
@inherits LocalizableComponentBase
@* The staff's picks (/clientapi/admin/staff-picks): the accounts suggested first to every persona, in their order, a
persona here or a person elsewhere, found among the accounts this server knows (/api/v2/search, never resolving).
PrivaPub keeps 40 at most and refuses an account picked already (409) or one it can't suggest (404: a community, a
server's actor, a suspended or deleted account). One deleted, suspended or silenced since stays listed, suggested to
nobody. A pick is removed at once: it can be picked again. Every change is in the staff's log. *@
<div class="flex flex-col gap-4 w-full" data-staff-picks>
@if (IsLoading)
{
<p class="flex w-full items-center justify-center gap-2">
<DLoading Variant="DLoadingVariant.Dots" LabelText="@Localizer["loading"]" />
@Localizer["loading"]
</p>
}
else
{
<p class="text-xs opacity-70">@Localizer["Suggested first to every persona of this server, in this order, under Explore's Who to follow."]</p>
@if (picks.Count == 0)
{
<p class="text-sm opacity-70" data-staff-picks-empty>@Localizer["No account is picked yet."]</p>
}
else
{
<ul class="flex flex-col gap-2">
@foreach (var pick in picks)
{
<li class="flex flex-wrap items-center gap-2 pointer-coarse:gap-2 p-2 rounded-lg neo-raised neo-2xs @(pick.IsShown ? null : "opacity-60")"
data-staff-pick="@pick.Handle" data-staff-pick-id="@pick.AccountId" data-staff-pick-shown="@(pick.IsShown ? "true" : "false")">
<i class="@(pick.IsLocal ? "ion-md-person" : "ion-md-globe") text-lg" aria-hidden="true"></i>
<a class="flex flex-col min-w-0 flex-1" href="@($"account/{Uri.EscapeDataString(pick.AccountId)}")">
<b class="truncate">@(pick.Name ?? pick.Handle ?? pick.AccountId)</b>
<span class="text-xs opacity-70 truncate">@(pick.Handle is { Length: > 0 } handle ? "@" + handle : pick.AccountId)</span>
</a>
@if (!pick.IsShown)
{
<DBadge Size="DSize.Sm" Variant="DBadgeVariant.Soft" Color="DColor.Warning"
title="@Localizer["Deleted, suspended or silenced since it was picked: suggested to nobody."]">@Localizer["Not suggested now"]</DBadge>
}
<DButton Size="DSize.Sm" Disabled="@(IsDefaultDisabled || isActing)" OnClick="() => Remove(pick)" data-staff-pick-remove>
<i class="ion-md-close" aria-hidden="true"></i><span>@Localizer["Remove"]</span>
</DButton>
</li>
}
</ul>
}
<div class="flex flex-col gap-2">
<div class="flex flex-wrap items-center gap-2">
<DInput TValue="string" class="flex-1 min-w-48" Value="query" ValueChanged="Search" ValueExpression="() => query" Immediate="true"
autocomplete="off" placeholder="@Localizer["Search accounts here and elsewhere"]" aria-label="@Localizer["Search accounts here and elsewhere"]"
disabled="@IsFull" data-staff-pick-search>
<Prefix><i class="ion-md-search" aria-hidden="true"></i></Prefix>
</DInput>
<span class="text-xs opacity-70 tabular-nums" data-staff-picks-count>@picks.Count/@MaxPicks</span>
</div>
@if (query is { Length: > 0 })
{
<div class="flex flex-wrap gap-2 pointer-coarse:gap-2" data-staff-pick-options>
@foreach (var account in matches)
{
<DButton Size="DSize.Sm" class="max-w-full" Disabled="@(IsDefaultDisabled || isActing || IsFull)" OnClick="() => Add(account)"
data-staff-pick-option="@account.Id">
<i class="ion-md-add" aria-hidden="true"></i>
<span class="truncate">@account.Name</span><span class="text-xs opacity-70 truncate">@("@" + account.Acct)</span>
</DButton>
}
@if (matches.Count == 0 && !isSearching)
{
<span class="text-xs opacity-70">@Localizer["No account matches."]</span>
}
</div>
}
</div>
}
</div>
@code {
[Inject] InstanceAdminService InstanceAdminService { get; set; }
[Inject] AccountService AccountService { get; set; }
/// <summary>PrivaPub's limit (InstanceAdminController.MaxStaffPicks).</summary>
const int MaxPicks = 40;
List<ViewStaffPick> picks = [];
string query;
List<Account> matches = [];
int searching;
bool isSearching;
bool isActing;
bool IsFull => picks.Count >= MaxPicks;
protected override async Task OnInitializedAsync()
{
if (CascadingState.IsOffline)
{
WhenOnline(LoadData);
StartOnlinePolling();
IsLoading = false;
return;
}
await LoadData();
IsLoading = false;
}
async Task LoadData() => picks = await InstanceAdminService.StaffPicks();
async Task Search(string typed)
{
query = typed;
var lookup = ++searching;
if (string.IsNullOrWhiteSpace(typed))
{
matches = [];
isSearching = false;
return;
}
isSearching = true;
await Task.Delay(300);
if (lookup != searching)
return;
var found = await AccountService.Suggest(typed.Trim(), false);
if (lookup != searching)
return;
// people only (PrivaPub takes no community), and none picked already
matches = [.. found.Accounts.Where(a => !a.Group && picks.All(p => p.AccountId != a.Id))];
isSearching = false;
}
async Task Add(Account account)
{
isActing = true;
var result = await InstanceAdminService.AddStaffPick(account.Id);
isActing = false;
if (result.IsInvalid)
{
Toast.AddResponseError(result);
return;
}
picks = (List<ViewStaffPick>)result.Data;
query = null;
matches = [];
Toast.AddResponseSuccess(Localizer["{0} is suggested to every persona.", account.Name]);
}
async Task Remove(ViewStaffPick pick)
{
isActing = true;
var result = await InstanceAdminService.RemoveStaffPick(pick.AccountId);
isActing = false;
if (result.IsInvalid)
{
Toast.AddResponseError(result);
return;
}
picks = (List<ViewStaffPick>)result.Data;
Toast.AddResponseSuccess(Localizer["{0} is no longer suggested by the staff.", pick.Name ?? pick.Handle ?? pick.AccountId]);
}
}