diff --git a/crates/adapters/activitypub-base/src/service.rs b/crates/adapters/activitypub-base/src/service.rs index f2c185f..d01e953 100644 --- a/crates/adapters/activitypub-base/src/service.rs +++ b/crates/adapters/activitypub-base/src/service.rs @@ -1278,6 +1278,8 @@ impl ActivityPubService { #[async_trait::async_trait] impl domain::ports::OutboundFederationPort for ActivityPubService { + // Actor identity (ap_id, followers_url) comes from federation config via get_local_actor. + // author_username is provided by the caller but not needed here. async fn broadcast_create( &self, author_user_id: &domain::value_objects::UserId, @@ -1328,6 +1330,8 @@ impl domain::ports::OutboundFederationPort for ActivityPubService { .map_err(|e| domain::errors::DomainError::Internal(e.to_string())) } + // Actor identity (ap_id, followers_url) comes from federation config via get_local_actor. + // author_username is provided by the caller but not needed here. async fn broadcast_update( &self, author_user_id: &domain::value_objects::UserId, @@ -1340,10 +1344,11 @@ impl domain::ports::OutboundFederationPort for ActivityPubService { .await .map_err(|e| domain::errors::DomainError::Internal(e.to_string()))?; - let ap_id = format!("{}/thoughts/{}", self.base_url, thought.id); + let ap_id = url::Url::parse(&format!("{}/thoughts/{}", self.base_url, thought.id)) + .map_err(|e| domain::errors::DomainError::Internal(e.to_string()))?; let mut note = serde_json::json!({ "type": "Note", - "id": ap_id, + "id": ap_id.to_string(), "attributedTo": local_actor.ap_id.to_string(), "content": thought.content.as_str(), "published": thought.created_at.to_rfc3339(), @@ -1357,6 +1362,9 @@ impl domain::ports::OutboundFederationPort for ActivityPubService { if let Some(ref reply_url) = thought.in_reply_to_url { note["inReplyTo"] = serde_json::json!(reply_url); } + if let Some(updated_at) = thought.updated_at { + note["updated"] = serde_json::json!(updated_at.to_rfc3339()); + } self.broadcast_update_to_followers(user_uuid, note) .await