]> Untitled Git - lemmy.git/commitdiff
Make delete activities backwards compatible with 0.15 (#2114)
authorNutomic <me@nutomic.com>
Thu, 3 Mar 2022 19:37:12 +0000 (19:37 +0000)
committerGitHub <noreply@github.com>
Thu, 3 Mar 2022 19:37:12 +0000 (19:37 +0000)
crates/apub/src/activities/deletion/delete.rs
crates/apub/src/protocol/activities/deletion/delete.rs

index e141fcadd04087f9af2824211ba0b6d5377501d1..3bb4b5bc8691e6cadcaf1f7618d7c105835e3950 100644 (file)
@@ -6,7 +6,7 @@ use crate::{
     verify_activity,
   },
   objects::{community::ApubCommunity, person::ApubPerson},
-  protocol::activities::deletion::delete::{Delete, IdOrNestedObject},
+  protocol::activities::deletion::delete::{Delete, IdOrNestedObject, NestedObject},
 };
 use activitystreams_kinds::activity::DeleteType;
 use anyhow::anyhow;
@@ -104,7 +104,10 @@ impl Delete {
     Ok(Delete {
       actor: ObjectId::new(actor.actor_id.clone()),
       to: vec![to],
-      object: IdOrNestedObject::Id(object.id()),
+      object: IdOrNestedObject::NestedObject(NestedObject {
+        id: object.id(),
+        kind: Default::default(),
+      }),
       cc: cc.into_iter().collect(),
       kind: DeleteType::Delete,
       summary,
index 6913652faf73324cd521d3e9af82aa07aeffafee..d3ec53be549ab75d8df1e97f6f55b76affa0543f 100644 (file)
@@ -1,5 +1,5 @@
 use crate::{objects::person::ApubPerson, protocol::Unparsed};
-use activitystreams_kinds::activity::DeleteType;
+use activitystreams_kinds::{activity::DeleteType, object::TombstoneType};
 use lemmy_apub_lib::object_id::ObjectId;
 use serde::{Deserialize, Serialize};
 use serde_with::skip_serializing_none;
@@ -39,7 +39,10 @@ pub(crate) enum IdOrNestedObject {
 
 #[derive(Clone, Debug, Deserialize, Serialize)]
 pub(crate) struct NestedObject {
-  id: Url,
+  pub(crate) id: Url,
+  // Backwards compatibility with Lemmy 0.15
+  #[serde(rename = "type")]
+  pub(crate) kind: TombstoneType,
 }
 
 impl IdOrNestedObject {