fix(ap): visibility-aware addressing — correct to/cc outbound, parse inbound to/cc
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m25s
test / unit (pull_request) Successful in 16m39s
test / integration (pull_request) Failing after 17m35s

This commit is contained in:
2026-05-14 19:34:43 +02:00
parent a5ea97bbaa
commit 8602614e7c
5 changed files with 45 additions and 3 deletions

View File

@@ -111,6 +111,24 @@ impl ApObjectHandler for ThoughtsObjectHandler {
.intern_remote_actor(actor_url)
.await
.map_err(|e| anyhow!("{e}"))?;
// Derive visibility from AP addressing conventions.
let as_public = "https://www.w3.org/ns/activitystreams#Public";
let in_to = note.to.iter().any(|s| s == as_public);
let in_cc = note.cc.iter().any(|s| s == as_public);
let has_followers = note.to.iter().any(|s| s.ends_with("/followers"))
|| note.cc.iter().any(|s| s.ends_with("/followers"));
let visibility = if in_to {
"public"
} else if in_cc {
"unlisted"
} else if has_followers {
"followers"
} else {
"direct"
};
self.repo
.accept_note(
ap_id,
@@ -119,6 +137,7 @@ impl ApObjectHandler for ThoughtsObjectHandler {
note.published,
note.sensitive,
note.summary,
visibility,
)
.await
.map_err(|e| anyhow!("{e}"))