From 234f5c206024ed2e87ad041b561b237f649a73d8 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Tue, 10 Sep 2024 12:35:58 +0200 Subject: [PATCH] Remove nonstandard field `expires` from apub block activity (ref #2316) (#4542) * Migrate apub block activity to standard `endTime` property (fixes #2316) * Remove nonstandard apub field `expires` (ref #2316) --- crates/apub/assets/lemmy/activities/block/block_user.json | 2 +- crates/apub/assets/lemmy/activities/block/undo_block_user.json | 2 +- crates/apub/src/activities/block/block_user.rs | 3 +-- crates/apub/src/activities/block/undo_block_user.rs | 2 +- crates/apub/src/protocol/activities/block/block_user.rs | 2 -- 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/apub/assets/lemmy/activities/block/block_user.json b/crates/apub/assets/lemmy/activities/block/block_user.json index a07d3786c..f6d6170c3 100644 --- a/crates/apub/assets/lemmy/activities/block/block_user.json +++ b/crates/apub/assets/lemmy/activities/block/block_user.json @@ -8,6 +8,6 @@ "type": "Block", "removeData": true, "summary": "spam post", - "expires": "2021-11-01T12:23:50.151874Z", + "endTime": "2021-11-01T12:23:50.151874Z", "id": "http://enterprise.lemmy.ml/activities/block/5d42fffb-0903-4625-86d4-0b39bb344fc2" } diff --git a/crates/apub/assets/lemmy/activities/block/undo_block_user.json b/crates/apub/assets/lemmy/activities/block/undo_block_user.json index 5dadc0781..922b5e777 100644 --- a/crates/apub/assets/lemmy/activities/block/undo_block_user.json +++ b/crates/apub/assets/lemmy/activities/block/undo_block_user.json @@ -11,7 +11,7 @@ "type": "Block", "removeData": true, "summary": "spam post", - "expires": "2021-11-01T12:23:50.151874Z", + "endTime": "2021-11-01T12:23:50.151874Z", "id": "http://enterprise.lemmy.ml/activities/block/726f43ab-bd0e-4ab3-89c8-627e976f553c" }, "cc": ["http://enterprise.lemmy.ml/c/main"], diff --git a/crates/apub/src/activities/block/block_user.rs b/crates/apub/src/activities/block/block_user.rs index 48408c4fb..e6c97c424 100644 --- a/crates/apub/src/activities/block/block_user.rs +++ b/crates/apub/src/activities/block/block_user.rs @@ -74,7 +74,6 @@ impl BlockUser { &context.settings().get_protocol_and_hostname(), )?, audience, - expires, end_time: expires, }) } @@ -157,7 +156,7 @@ impl ActivityHandler for BlockUser { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> LemmyResult<()> { insert_received_activity(&self.id, context).await?; - let expires = self.expires.or(self.end_time).map(Into::into); + let expires = self.end_time.map(Into::into); let mod_person = self.actor.dereference(context).await?; let blocked_person = self.object.dereference(context).await?; let target = self.target.dereference(context).await?; diff --git a/crates/apub/src/activities/block/undo_block_user.rs b/crates/apub/src/activities/block/undo_block_user.rs index b92320b2d..69f3eeebf 100644 --- a/crates/apub/src/activities/block/undo_block_user.rs +++ b/crates/apub/src/activities/block/undo_block_user.rs @@ -98,7 +98,7 @@ impl ActivityHandler for UndoBlockUser { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> LemmyResult<()> { insert_received_activity(&self.id, context).await?; - let expires = self.object.expires.or(self.object.end_time).map(Into::into); + let expires = self.object.end_time.map(Into::into); let mod_person = self.actor.dereference(context).await?; let blocked_person = self.object.object.dereference(context).await?; match self.object.target.dereference(context).await? { diff --git a/crates/apub/src/protocol/activities/block/block_user.rs b/crates/apub/src/protocol/activities/block/block_user.rs index c1a4c64c7..96135d645 100644 --- a/crates/apub/src/protocol/activities/block/block_user.rs +++ b/crates/apub/src/protocol/activities/block/block_user.rs @@ -38,8 +38,6 @@ pub struct BlockUser { pub(crate) remove_data: Option, /// block reason, written to mod log pub(crate) summary: Option, - /// TODO: deprecated - pub(crate) expires: Option>, pub(crate) end_time: Option>, }