fix: send Undo(Block) on unblock_actor
All checks were successful
CI / fmt (push) Successful in 20s
CI / clippy (push) Successful in 2m33s
CI / test (push) Successful in 3m31s

This commit is contained in:
2026-06-30 01:49:30 +02:00
parent d1ce277ff5
commit 9355f20616
3 changed files with 34 additions and 1 deletions

View File

@@ -1,5 +1,13 @@
# Changelog # Changelog
## [0.4.1] — 2026-06-30
### Bug fixes
- `unblock_actor` now sends an `Undo(Block)` activity to the remote actor's inbox before removing them from the local blocklist, making unblocking AP-compliant.
---
## [0.4.0] — 2026-05-30 ## [0.4.0] — 2026-05-30
### Breaking changes ### Breaking changes

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "k-ap" name = "k-ap"
version = "0.4.0" version = "0.4.1"
edition = "2024" edition = "2024"
description = "Generic ActivityPub protocol layer" description = "Generic ActivityPub protocol layer"
license = "MIT" license = "MIT"

View File

@@ -328,7 +328,32 @@ impl ActivityPubService {
let data = self.federation_config.to_request_data(); let data = self.federation_config.to_request_data();
data.blocklist_repo data.blocklist_repo
.remove_blocked_actor(local_user_id, actor_url) .remove_blocked_actor(local_user_id, actor_url)
.await?;
let local_actor = get_local_actor(local_user_id, &data)
.await .await
.map_err(|e| anyhow::anyhow!("{e}"))?;
if let Ok(Some(remote_actor)) = data.actor_repo.get_remote_actor(actor_url).await {
let block = crate::activities::BlockActivity {
id: activity_url(&self.base_url).map_err(|e| anyhow::anyhow!("{e}"))?,
kind: Default::default(),
actor: ObjectId::from(local_actor.ap_id.clone()),
object: Url::parse(actor_url)?,
};
let undo = UndoActivity {
id: activity_url(&self.base_url).map_err(|e| anyhow::anyhow!("{e}"))?,
kind: Default::default(),
actor: ObjectId::from(local_actor.ap_id.clone()),
object: serde_json::to_value(&block).map_err(|e| anyhow::anyhow!("{e}"))?,
};
let inbox = Url::parse(&remote_actor.inbox_url)?;
let (json, sends, inboxes) = self
.prepare_broadcast(&data, &local_actor, vec![inbox], undo)
.await?;
self.dispatch_deliveries(&data, &local_actor, inboxes, sends, json)
.await?;
tracing::info!(actor = %actor_url, "sent Undo(Block)");
}
Ok(())
} }
pub async fn get_blocked_actors( pub async fn get_blocked_actors(