Pinned posts on profiles, and pinning from the card
A profile shows the posts the account pins above its posts (pinned=true: for an account elsewhere, what it features, which PrivaPub now keeps); the persona pins and unpins its own public and unlisted posts from the card's menu, and PrivaPub tells its followers. tests/e2e/Actions/PinTests.cs pins from the card and finds the post first on the profile; the whole e2e suite passes against the reseeded village (122, 4 skipped). 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
a5178a67b1
commit
da98addf76
8 files changed
+119
-3
No files matched your search
+20
-2
@@ -147,7 +147,17 @@
|
||||
</DTabs>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
@foreach (var post in posts)
|
||||
@if (tab is ProfileTab.Posts && pinned.Count > 0)
|
||||
{
|
||||
<div class="flex flex-col gap-4" data-pinned>
|
||||
<span class="badge badge-ghost gap-1 self-start"><i aria-hidden="true" class="ion-md-pin"></i>@Localizer["Pinned"]</span>
|
||||
@foreach (var post in pinned)
|
||||
{
|
||||
<Content @key="post.Key" Post="post" FilterIn="FilterContext.Account" OnDeleted="Remove" OnTag="OpenTag" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@foreach (var post in posts.Where(p => tab is not ProfileTab.Posts || !pinnedKeys.Contains(p.Key)))
|
||||
{
|
||||
<Content @key="post.Key" Post="post" FilterIn="FilterContext.Account" OnDeleted="Remove" OnTag="OpenTag" />
|
||||
}
|
||||
@@ -182,6 +192,8 @@
|
||||
Account account;
|
||||
Relationship relationship;
|
||||
List<FeedPost> posts = [];
|
||||
List<FeedPost> pinned = [];
|
||||
HashSet<string> pinnedKeys = [];
|
||||
ProfileTab tab = ProfileTab.Posts;
|
||||
string maxId;
|
||||
string loadedId;
|
||||
@@ -234,6 +246,8 @@
|
||||
}
|
||||
relationship = account.Id == CascadingState.PersonaId ? null : await AccountService.Relationship(account.Id);
|
||||
await LoadLists();
|
||||
pinned = await AccountService.Pinned(account.Id);
|
||||
pinnedKeys = [.. pinned.Select(p => p.Key)];
|
||||
posts = [];
|
||||
maxId = null;
|
||||
IsLoading = false;
|
||||
@@ -329,7 +343,11 @@
|
||||
});
|
||||
}
|
||||
|
||||
void Remove(FeedPost post) => posts.RemoveAll(p => p.Key == post.Key);
|
||||
void Remove(FeedPost post)
|
||||
{
|
||||
posts.RemoveAll(p => p.Key == post.Key);
|
||||
pinned.RemoveAll(p => p.Key == post.Key);
|
||||
}
|
||||
|
||||
async Task OpenTag(string tagName)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user