diff --git a/crates/adapters/activitypub-base/src/service.rs b/crates/adapters/activitypub-base/src/service.rs index 4a92c57..84510a7 100644 --- a/crates/adapters/activitypub-base/src/service.rs +++ b/crates/adapters/activitypub-base/src/service.rs @@ -1390,6 +1390,26 @@ impl domain::ports::OutboundFederationPort for ActivityPubService { .await .map_err(|e| domain::errors::DomainError::Internal(e.to_string())) } + + async fn broadcast_like( + &self, + _liker_user_id: &domain::value_objects::UserId, + _object_ap_id: &str, + _author_inbox_url: &str, + ) -> Result<(), domain::errors::DomainError> { + // TODO: implement Like activity broadcasting + Ok(()) + } + + async fn broadcast_undo_like( + &self, + _liker_user_id: &domain::value_objects::UserId, + _object_ap_id: &str, + _author_inbox_url: &str, + ) -> Result<(), domain::errors::DomainError> { + // TODO: implement Undo(Like) activity broadcasting + Ok(()) + } } #[async_trait::async_trait] diff --git a/crates/application/src/services/federation_event.rs b/crates/application/src/services/federation_event.rs index bfc6725..8b57fb1 100644 --- a/crates/application/src/services/federation_event.rs +++ b/crates/application/src/services/federation_event.rs @@ -249,6 +249,8 @@ mod tests { updated: Mutex>, announced: Mutex>, undo_announced: Mutex>, + liked: Mutex>, + undo_liked: Mutex>, } #[async_trait] @@ -287,6 +289,26 @@ mod tests { self.undo_announced.lock().unwrap().push(ap_id.to_string()); Ok(()) } + + async fn broadcast_like( + &self, + _: &UserId, + ap_id: &str, + _: &str, + ) -> Result<(), DomainError> { + self.liked.lock().unwrap().push(ap_id.to_string()); + Ok(()) + } + + async fn broadcast_undo_like( + &self, + _: &UserId, + ap_id: &str, + _: &str, + ) -> Result<(), DomainError> { + self.undo_liked.lock().unwrap().push(ap_id.to_string()); + Ok(()) + } } fn alice() -> User { diff --git a/crates/domain/src/ports.rs b/crates/domain/src/ports.rs index 2831aef..68f8858 100644 --- a/crates/domain/src/ports.rs +++ b/crates/domain/src/ports.rs @@ -453,4 +453,21 @@ pub trait OutboundFederationPort: Send + Sync { booster_user_id: &UserId, object_ap_id: &str, ) -> Result<(), DomainError>; + + /// Send a Like activity to a remote thought author's inbox. + /// Only called when a LOCAL user likes a REMOTE thought (one with an ap_id). + async fn broadcast_like( + &self, + liker_user_id: &UserId, + object_ap_id: &str, + author_inbox_url: &str, + ) -> Result<(), DomainError>; + + /// Send Undo(Like) to a remote thought author's inbox. + async fn broadcast_undo_like( + &self, + liker_user_id: &UserId, + object_ap_id: &str, + author_inbox_url: &str, + ) -> Result<(), DomainError>; }