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 struct ApFederationAdapter {
|
||||||
pub(crate) inner: Arc<ActivityPubService>,
|
pub(crate) inner: Arc<ActivityPubService>,
|
||||||
pub(crate) connections_repo: Arc<dyn RemoteActorConnectionRepository>,
|
pub(crate) connections_repo: Arc<dyn RemoteActorConnectionRepository>,
|
||||||
|
pub(crate) federation_repo: Arc<dyn k_ap::FederationRepository>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ApFederationAdapter {
|
impl ApFederationAdapter {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
inner: Arc<ActivityPubService>,
|
inner: Arc<ActivityPubService>,
|
||||||
connections_repo: Arc<dyn RemoteActorConnectionRepository>,
|
connections_repo: Arc<dyn RemoteActorConnectionRepository>,
|
||||||
|
federation_repo: Arc<dyn k_ap::FederationRepository>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner,
|
inner,
|
||||||
connections_repo,
|
connections_repo,
|
||||||
|
federation_repo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,6 +810,28 @@ impl FederationFollowRequestPort for ApFederationAdapter {
|
|||||||
.await
|
.await
|
||||||
.map_err(|e| DomainError::ExternalService(e.to_string()))
|
.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.
|
// FederationActionPort is a blanket supertrait; no explicit impl needed.
|
||||||
|
|||||||
Reference in New Issue
Block a user