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.
38 lines
1.7 KiB
Rust
38 lines
1.7 KiB
Rust
use anyhow::Result;
|
|
use async_trait::async_trait;
|
|
|
|
use super::RemoteActor;
|
|
|
|
/// Manages local actor keypairs, remote actor cache, and Announce tracking.
|
|
#[async_trait]
|
|
pub trait ActorRepository: Send + Sync {
|
|
// ── Local keypairs ──────────────────────────────────────────────────────
|
|
async fn get_local_actor_keypair(
|
|
&self,
|
|
user_id: uuid::Uuid,
|
|
) -> Result<Option<(String, String)>>;
|
|
async fn save_local_actor_keypair(
|
|
&self,
|
|
user_id: uuid::Uuid,
|
|
public_key: String,
|
|
private_key: String,
|
|
) -> Result<()>;
|
|
|
|
// ── Remote actor cache ──────────────────────────────────────────────────
|
|
async fn upsert_remote_actor(&self, actor: RemoteActor) -> Result<()>;
|
|
async fn get_remote_actor(&self, actor_url: &str) -> Result<Option<RemoteActor>>;
|
|
|
|
// ── Boost (Announce) tracking ───────────────────────────────────────────
|
|
async fn add_announce(
|
|
&self,
|
|
activity_id: &str,
|
|
object_url: &str,
|
|
actor_url: &str,
|
|
announced_at: chrono::DateTime<chrono::Utc>,
|
|
) -> Result<()>;
|
|
/// Remove a boost record when a remote actor sends `Undo(Announce)`.
|
|
/// Implementations should match by `activity_id` and `actor_url`.
|
|
async fn remove_announce(&self, activity_id: &str, actor_url: &str) -> Result<()>;
|
|
async fn count_announces(&self, object_url: &str) -> Result<usize>;
|
|
}
|