From 3999e0485efadfe77e1c23bda878dba70131be06 Mon Sep 17 00:00:00 2001 From: Felix Ableitner <me@nutomic.com> Date: Wed, 3 Jun 2020 17:10:16 +0200 Subject: [PATCH] migrate tombstone --- server/src/apub/comment.rs | 3 ++- server/src/apub/community.rs | 3 ++- server/src/apub/mod.rs | 17 ++++++++++------- server/src/apub/post.rs | 3 ++- server/src/apub/private_message.rs | 3 ++- server/src/apub/user.rs | 3 ++- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/server/src/apub/comment.rs b/server/src/apub/comment.rs index 7c77a1c7885..d18908d0e84 100644 --- a/server/src/apub/comment.rs +++ b/server/src/apub/comment.rs @@ -28,8 +28,9 @@ use activitystreams::{ activity::{Create, Delete, Dislike, Like, Remove, Undo, Update}, context, link::Mention, - object::{kind::NoteType, properties::ObjectProperties, Note, Tombstone}, + object::{kind::NoteType, properties::ObjectProperties, Note}, }; +use activitystreams_new::object::Tombstone; use actix_web::{body::Body, web::Path, HttpResponse, Result}; use diesel::PgConnection; use failure::Error; diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs index a81e21cfa32..79615aca74d 100644 --- a/server/src/apub/community.rs +++ b/server/src/apub/community.rs @@ -28,12 +28,13 @@ use activitystreams::{ collection::UnorderedCollection, context, endpoint::EndpointProperties, - object::{properties::ObjectProperties, Tombstone}, + object::properties::ObjectProperties, Activity, Base, BaseBox, }; use activitystreams_ext::Ext3; +use activitystreams_new::object::Tombstone; use actix_web::{body::Body, web::Path, HttpResponse, Result}; use diesel::PgConnection; use failure::{Error, _core::fmt::Debug}; diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index 805e6a0c323..5260e3098a7 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -25,9 +25,14 @@ use crate::{ use activitystreams::{ activity::Follow, actor::{properties::ApActorProperties, Group, Person}, - object::{Page, Tombstone}, + object::Page, }; use activitystreams_ext::{Ext1, Ext2, Ext3}; +use activitystreams_new::{ + base::BaseExt, + object::{Tombstone, TombstoneExt}, + primitives::XsdString, +}; use actix_web::{body::Body, HttpResponse, Result}; use chrono::NaiveDateTime; use diesel::PgConnection; @@ -132,12 +137,10 @@ fn create_tombstone( ) -> Result<Tombstone, Error> { if deleted { if let Some(updated) = updated { - let mut tombstone = Tombstone::default(); - tombstone.object_props.set_id(object_id)?; - tombstone - .tombstone_props - .set_former_type_xsd_string(former_type)? - .set_deleted(convert_datetime(updated))?; + let mut tombstone = Tombstone::new(); + tombstone.set_id(object_id.parse()?); + tombstone.set_former_type(former_type.parse::<XsdString>()?); + tombstone.set_deleted(convert_datetime(updated).into()); Ok(tombstone) } else { Err(format_err!( diff --git a/server/src/apub/post.rs b/server/src/apub/post.rs index f53af309123..3f86d34d113 100644 --- a/server/src/apub/post.rs +++ b/server/src/apub/post.rs @@ -27,10 +27,11 @@ use crate::{ use activitystreams::{ activity::{Create, Delete, Dislike, Like, Remove, Undo, Update}, context, - object::{kind::PageType, properties::ObjectProperties, AnyImage, Image, Page, Tombstone}, + object::{kind::PageType, properties::ObjectProperties, AnyImage, Image, Page}, BaseBox, }; use activitystreams_ext::Ext1; +use activitystreams_new::object::Tombstone; use actix_web::{body::Body, web::Path, HttpResponse, Result}; use diesel::PgConnection; use failure::Error; diff --git a/server/src/apub/private_message.rs b/server/src/apub/private_message.rs index a222b1fef4e..a700043ba4b 100644 --- a/server/src/apub/private_message.rs +++ b/server/src/apub/private_message.rs @@ -18,8 +18,9 @@ use crate::{ use activitystreams::{ activity::{Create, Delete, Undo, Update}, context, - object::{kind::NoteType, properties::ObjectProperties, Note, Tombstone}, + object::{kind::NoteType, properties::ObjectProperties, Note}, }; +use activitystreams_new::object::Tombstone; use actix_web::Result; use diesel::PgConnection; use failure::Error; diff --git a/server/src/apub/user.rs b/server/src/apub/user.rs index 0a651d1fe35..77b012fddc0 100644 --- a/server/src/apub/user.rs +++ b/server/src/apub/user.rs @@ -21,9 +21,10 @@ use activitystreams::{ actor::{properties::ApActorProperties, Person}, context, endpoint::EndpointProperties, - object::{properties::ObjectProperties, AnyImage, Image, Tombstone}, + object::{properties::ObjectProperties, AnyImage, Image}, }; use activitystreams_ext::Ext2; +use activitystreams_new::object::Tombstone; use actix_web::{body::Body, web::Path, HttpResponse, Result}; use diesel::PgConnection; use failure::Error;