feat(activitypub): add federation_repo field and thin DB-only methods to ApFederationAdapter
This commit is contained in:
@@ -209,16 +209,19 @@ async fn webfinger_resolve_actor_url(handle: &str) -> anyhow::Result<String> {
|
||||
pub struct ApFederationAdapter {
|
||||
pub(crate) inner: Arc<ActivityPubService>,
|
||||
pub(crate) connections_repo: Arc<dyn RemoteActorConnectionRepository>,
|
||||
pub(crate) federation_repo: Arc<dyn k_ap::FederationRepository>,
|
||||
}
|
||||
|
||||
impl ApFederationAdapter {
|
||||
pub fn new(
|
||||
inner: Arc<ActivityPubService>,
|
||||
connections_repo: Arc<dyn RemoteActorConnectionRepository>,
|
||||
federation_repo: Arc<dyn k_ap::FederationRepository>,
|
||||
) -> Self {
|
||||
Self {
|
||||
inner,
|
||||
connections_repo,
|
||||
federation_repo,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,6 +810,28 @@ impl FederationFollowRequestPort for ApFederationAdapter {
|
||||
.await
|
||||
.map_err(|e| DomainError::ExternalService(e.to_string()))
|
||||
}
|
||||
|
||||
async fn mark_follower_accepted(
|
||||
&self,
|
||||
user_id: &UserId,
|
||||
actor_url: &str,
|
||||
) -> Result<(), DomainError> {
|
||||
self.federation_repo
|
||||
.update_follower_status(user_id.as_uuid(), actor_url, k_ap::FollowerStatus::Accepted)
|
||||
.await
|
||||
.map_err(|e| DomainError::Internal(e.to_string()))
|
||||
}
|
||||
|
||||
async fn mark_follower_rejected(
|
||||
&self,
|
||||
user_id: &UserId,
|
||||
actor_url: &str,
|
||||
) -> Result<(), DomainError> {
|
||||
self.federation_repo
|
||||
.remove_follower(user_id.as_uuid(), actor_url)
|
||||
.await
|
||||
.map_err(|e| DomainError::Internal(e.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
// FederationActionPort is a blanket supertrait; no explicit impl needed.
|
||||
|
||||
Reference in New Issue
Block a user