A remote account's searchableBy, and a post's own, outrank indexable in status search: Public lets anyone find a public post, the author's followers only those who follow it, anything else nobody but those it already reaches (their own, named, favourited, bookmarked or boosted posts). Read on actors and posts, kept through edits; PrivaPub does not emit it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
This commit is contained in:
1 parent
d4b1788a4f
commit
fb4949b511
11 files changed
+111
-5
No files matched your search
@@ -100,6 +100,18 @@ namespace PrivaPub.Federation.Objects
|
||||
|
||||
const int MaxFlairs = 20;
|
||||
|
||||
// FEP-268d: who may find this in a search (Public, the author's followers, nobody else); null when not stated
|
||||
public static List<string> SearchableBy(JsonNode node) => node switch
|
||||
{
|
||||
null => default,
|
||||
JsonArray array => array.Select(Id).Where(id => id != default).Take(MaxAudience).ToList(),
|
||||
_ when Id(node) is { } single => new List<string> { single },
|
||||
_ => new List<string>()
|
||||
};
|
||||
|
||||
public static bool Searchable(List<string> searchableBy, string followers, bool viewerFollows) =>
|
||||
searchableBy.Any(Addressing.IsPublic) || viewerFollows && searchableBy.Any(w => w == followers || w.EndsWith("/followers", StringComparison.Ordinal));
|
||||
|
||||
// a post's flairs, or a community's (its `tag`, and PieFed's older `lemmy:tagsForPosts`), in both dialects
|
||||
public static List<PostFlair> Flairs(params JsonNode[] lists) =>
|
||||
lists.SelectMany(Objects)
|
||||
|
||||
Reference in new issue
Block a user