One visibility rule for every public read

VisibilityPolicy.IsPublic is the single expression for "anyone may see
this" (Public or Unlisted, not deleted); the outbox, the object and
activity endpoints, the HTML pages and NodeInfo all use it instead of
spelling it out. CanSee answers for a persona: the author, a mentioned
local persona, a conversation member for Direct, a circle member for
Circle; followers-only waits for P1.2's follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-10-01 11:26:51 +02:00
1 parent 5a13597c00
commit 1c78da34a9
5 files changed
+97 -15

No files matched your search

+4 -3
View File
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using MongoDB.Entities;
using PrivaPub.Domain.Privacy;
using PrivaPub.Federation.Actors;
using PrivaPub.Federation.Rendering;
using PrivaPub.Models.Federation;
@@ -70,7 +71,7 @@ namespace PrivaPub.Web.Pages
var posts = await (Actor.Kind == LocalActorKind.Group
? _dbEntities.Posts.Match(p => p.GroupId == Actor.Id)
: _dbEntities.Posts.Match(p => p.GroupUserId == Actor.Id && !p.IsFederatedCopy))
.Match(p => !p.DeletedAt.HasValue && (p.Visibility == PostVisibility.Public || p.Visibility == PostVisibility.Unlisted))
.Match(VisibilityPolicy.IsPublic)
.Sort(p => p.ID, Order.Descending)
.Limit(PageSize)
.ExecuteAsync(token);
@@ -111,8 +112,8 @@ namespace PrivaPub.Web.Pages
if (Actor is not { IsFederated: true, Kind: LocalActorKind.Person })
return NotFound();
var post = await _dbEntities.Posts
.Match(p => p.ID == id && p.GroupUserId == Actor.Id && !p.IsFederatedCopy && !p.DeletedAt.HasValue
&& (p.Visibility == PostVisibility.Public || p.Visibility == PostVisibility.Unlisted))
.Match(p => p.ID == id && p.GroupUserId == Actor.Id && !p.IsFederatedCopy)
.Match(VisibilityPolicy.IsPublic)
.ExecuteFirstAsync(token);
if (post == default)
return NotFound();