Lists: a persona's followed accounts, read apart
Mastodon's lists replace the empty stubs: CRUD, members (only accounts the persona follows; a follow that ends takes its memberships with it), accounts/:id/lists, and timelines/list/:id from the persona's home entries with the replies policy (followed, list, none; self-replies and replies to the persona always). An exclusive list's members stay out of home. Lists never federate, and go with a deleted persona. 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
4b6d261739
commit
0614bdcf18
13 files changed
+406
-21
No files matched your search
@@ -30,7 +30,15 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
[HttpGet("/api/v1/timelines/home"), Scope("read:statuses")]
|
||||
public async Task<IActionResult> Home(CancellationToken token)
|
||||
{
|
||||
var entries = await Page.From(Params, Limit()).Fetch(_dbEntities.TimelineEntries.Match(e => e.AvatarId == MyId), e => e.PostId, token);
|
||||
//an exclusive list's members are read in that list, not at home
|
||||
var exclusive = (await DB.Default.Find<PersonaList>().Match(l => l.AvatarId == MyId && l.Exclusive).ExecuteAsync(token)).Select(l => l.ID).ToList();
|
||||
var apart = exclusive.Count == 0
|
||||
? new List<string>()
|
||||
: (await DB.Default.Find<PersonaListMember>().Match(m => exclusive.Contains(m.ListId)).ExecuteAsync(token)).Select(m => m.AccountId).Distinct().ToList();
|
||||
var home = _dbEntities.TimelineEntries.Match(e => e.AvatarId == MyId);
|
||||
if (apart.Count > 0)
|
||||
home.Match(e => !apart.Contains(e.AuthorAccountId));
|
||||
var entries = await Page.From(Params, Limit()).Fetch(home, e => e.PostId, token);
|
||||
var ids = entries.Select(e => e.PostId).ToList();
|
||||
var posts = (await _dbEntities.Posts.Match(p => ids.Contains(p.ID)).Match(VisibilityPolicy.IsShown).ExecuteAsync(token)).ToDictionary(p => p.ID);
|
||||
var statuses = await _mapper.Statuses(ids.Where(posts.ContainsKey).Select(id => posts[id]).ToList(), MyId, token);
|
||||
@@ -61,9 +69,6 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
return await Respond(query, $"/api/v1/timelines/tag/{hashtag}", token);
|
||||
}
|
||||
|
||||
[HttpGet("/api/v1/timelines/list/{id}"), Scope("read:lists")]
|
||||
public IActionResult List(string id) => Json(Array.Empty<Status>());
|
||||
|
||||
[HttpGet("/api/v1/favourites"), Scope("read:favourites")]
|
||||
public async Task<IActionResult> Favourites(CancellationToken token)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user