fix: AP protocol correctness gaps

Undo(Announce): now removes announce record from ActorRepository and
  calls ApObjectHandler::on_announce_removed (default no-op, override
  to decrement boost counts). Announce counts no longer drift.

Undo(Block): now logged at info level instead of silently ignored.
  No automatic relationship restoration (spec doesn't require it).

AddActivity: now uses object["id"] as the stable ap_id (same as
  CreateActivity), falling back to activity id only if object has no
  id field. Fixes keying watchlist/collection items by the wrong id.

Featured collection: GET /users/{id}/featured now served by the router.
  ApContentReader::get_featured_objects() has a default empty-list impl
  — override to expose pinned posts without any breaking changes.
This commit is contained in:
2026-05-29 02:29:38 +02:00
parent 5288696795
commit 48fded426f
8 changed files with 117 additions and 1 deletions

View File

@@ -54,7 +54,14 @@ impl Activity for AddActivity {
if check_guards(&self.id, self.actor.inner(), data).await? {
return Ok(());
}
let ap_id = self.id.clone();
// Use the object's own id as the stable AP identifier, falling back to
// the activity id only if the object has no id field.
let ap_id = self
.object
.get("id")
.and_then(|v| v.as_str())
.and_then(|s| Url::parse(s).ok())
.unwrap_or_else(|| self.id.clone());
let actor_url = self.actor.inner().clone();
data.object_handler
.on_create(&ap_id, &actor_url, self.object)