feat(domain): ActorConnectionSummary, ConnectionType, RemoteActorConnectionRepository, FetchActorConnections event

This commit is contained in:
2026-05-15 00:25:54 +02:00
parent 23501f5203
commit 99dd89b60d
8 changed files with 178 additions and 0 deletions

View File

@@ -1599,6 +1599,20 @@ impl domain::ports::FederationActionPort for ActivityPubService {
Ok(notes)
}
async fn fetch_actor_urls_from_collection(
&self,
_collection_url: &str,
) -> Result<Vec<String>, domain::errors::DomainError> {
Ok(vec![])
}
async fn resolve_actor_profiles(
&self,
_urls: Vec<String>,
) -> Vec<domain::models::actor_connection_summary::ActorConnectionSummary> {
vec![]
}
}
#[cfg(test)]

View File

@@ -72,6 +72,12 @@ pub enum EventPayload {
actor_ap_url: String,
outbox_url: String,
},
FetchActorConnections {
actor_ap_url: String,
collection_url: String,
connection_type: String,
page: u32,
},
}
impl EventPayload {
@@ -93,6 +99,7 @@ impl EventPayload {
Self::UserUnblocked { .. } => "users.unblocked",
Self::UserRegistered { .. } => "users.registered",
Self::FetchRemoteActorPosts { .. } => "federation.fetch_outbox",
Self::FetchActorConnections { .. } => "federation.fetch_connections",
}
}
}
@@ -209,6 +216,17 @@ impl From<&DomainEvent> for EventPayload {
actor_ap_url: actor_ap_url.clone(),
outbox_url: outbox_url.clone(),
},
DomainEvent::FetchActorConnections {
actor_ap_url,
collection_url,
connection_type,
page,
} => Self::FetchActorConnections {
actor_ap_url: actor_ap_url.clone(),
collection_url: collection_url.clone(),
connection_type: connection_type.clone(),
page: *page,
},
}
}
}
@@ -334,6 +352,17 @@ impl TryFrom<EventPayload> for DomainEvent {
actor_ap_url,
outbox_url,
},
EventPayload::FetchActorConnections {
actor_ap_url,
collection_url,
connection_type,
page,
} => DomainEvent::FetchActorConnections {
actor_ap_url,
collection_url,
connection_type,
page,
},
})
}
}
@@ -419,6 +448,12 @@ mod tests {
actor_ap_url: "https://mastodon.social/users/alice".into(),
outbox_url: "https://mastodon.social/users/alice/outbox".into(),
},
EventPayload::FetchActorConnections {
actor_ap_url: "https://mastodon.social/users/alice".into(),
collection_url: "https://mastodon.social/users/alice/followers".into(),
connection_type: "followers".into(),
page: 1,
},
];
let mut subjects: Vec<&str> = samples.iter().map(|p| p.subject()).collect();
subjects.sort();