Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate apub block activity to standard endTime property and deprecate expires (fixes #2316) #4541

Merged
merged 2 commits into from Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/apub/src/activities/block/block_user.rs
Expand Up @@ -72,6 +72,7 @@ impl BlockUser {
)?,
audience,
expires,
end_time: expires,
})
}

Expand Down Expand Up @@ -149,7 +150,7 @@ impl ActivityHandler for BlockUser {
#[tracing::instrument(skip_all)]
async fn receive(self, context: &Data<LemmyContext>) -> Result<(), LemmyError> {
insert_received_activity(&self.id, context).await?;
let expires = self.expires.map(Into::into);
let expires = self.expires.or(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?;
Expand Down
2 changes: 1 addition & 1 deletion crates/apub/src/activities/block/undo_block_user.rs
Expand Up @@ -98,7 +98,7 @@ impl ActivityHandler for UndoBlockUser {
#[tracing::instrument(skip_all)]
async fn receive(self, context: &Data<LemmyContext>) -> Result<(), LemmyError> {
insert_received_activity(&self.id, context).await?;
let expires = self.object.expires.map(Into::into);
let expires = self.object.expires.or(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? {
Expand Down
2 changes: 2 additions & 0 deletions crates/apub/src/protocol/activities/block/block_user.rs
Expand Up @@ -38,7 +38,9 @@ pub struct BlockUser {
pub(crate) remove_data: Option<bool>,
/// block reason, written to mod log
pub(crate) summary: Option<String>,
/// TODO: deprecated
pub(crate) expires: Option<DateTime<Utc>>,
pub(crate) end_time: Option<DateTime<Utc>>,
}

#[async_trait::async_trait]
Expand Down