migrate tombstone

This commit is contained in:
Felix Ableitner 2020-06-03 17:10:16 +02:00
parent 1aa30d855e
commit 3999e0485e
6 changed files with 20 additions and 12 deletions

View file

@ -28,8 +28,9 @@ use activitystreams::{
activity::{Create, Delete, Dislike, Like, Remove, Undo, Update}, activity::{Create, Delete, Dislike, Like, Remove, Undo, Update},
context, context,
link::Mention, 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 actix_web::{body::Body, web::Path, HttpResponse, Result};
use diesel::PgConnection; use diesel::PgConnection;
use failure::Error; use failure::Error;

View file

@ -28,12 +28,13 @@ use activitystreams::{
collection::UnorderedCollection, collection::UnorderedCollection,
context, context,
endpoint::EndpointProperties, endpoint::EndpointProperties,
object::{properties::ObjectProperties, Tombstone}, object::properties::ObjectProperties,
Activity, Activity,
Base, Base,
BaseBox, BaseBox,
}; };
use activitystreams_ext::Ext3; use activitystreams_ext::Ext3;
use activitystreams_new::object::Tombstone;
use actix_web::{body::Body, web::Path, HttpResponse, Result}; use actix_web::{body::Body, web::Path, HttpResponse, Result};
use diesel::PgConnection; use diesel::PgConnection;
use failure::{Error, _core::fmt::Debug}; use failure::{Error, _core::fmt::Debug};

View file

@ -25,9 +25,14 @@ use crate::{
use activitystreams::{ use activitystreams::{
activity::Follow, activity::Follow,
actor::{properties::ApActorProperties, Group, Person}, actor::{properties::ApActorProperties, Group, Person},
object::{Page, Tombstone}, object::Page,
}; };
use activitystreams_ext::{Ext1, Ext2, Ext3}; use activitystreams_ext::{Ext1, Ext2, Ext3};
use activitystreams_new::{
base::BaseExt,
object::{Tombstone, TombstoneExt},
primitives::XsdString,
};
use actix_web::{body::Body, HttpResponse, Result}; use actix_web::{body::Body, HttpResponse, Result};
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use diesel::PgConnection; use diesel::PgConnection;
@ -132,12 +137,10 @@ fn create_tombstone(
) -> Result<Tombstone, Error> { ) -> Result<Tombstone, Error> {
if deleted { if deleted {
if let Some(updated) = updated { if let Some(updated) = updated {
let mut tombstone = Tombstone::default(); let mut tombstone = Tombstone::new();
tombstone.object_props.set_id(object_id)?; tombstone.set_id(object_id.parse()?);
tombstone tombstone.set_former_type(former_type.parse::<XsdString>()?);
.tombstone_props tombstone.set_deleted(convert_datetime(updated).into());
.set_former_type_xsd_string(former_type)?
.set_deleted(convert_datetime(updated))?;
Ok(tombstone) Ok(tombstone)
} else { } else {
Err(format_err!( Err(format_err!(

View file

@ -27,10 +27,11 @@ use crate::{
use activitystreams::{ use activitystreams::{
activity::{Create, Delete, Dislike, Like, Remove, Undo, Update}, activity::{Create, Delete, Dislike, Like, Remove, Undo, Update},
context, context,
object::{kind::PageType, properties::ObjectProperties, AnyImage, Image, Page, Tombstone}, object::{kind::PageType, properties::ObjectProperties, AnyImage, Image, Page},
BaseBox, BaseBox,
}; };
use activitystreams_ext::Ext1; use activitystreams_ext::Ext1;
use activitystreams_new::object::Tombstone;
use actix_web::{body::Body, web::Path, HttpResponse, Result}; use actix_web::{body::Body, web::Path, HttpResponse, Result};
use diesel::PgConnection; use diesel::PgConnection;
use failure::Error; use failure::Error;

View file

@ -18,8 +18,9 @@ use crate::{
use activitystreams::{ use activitystreams::{
activity::{Create, Delete, Undo, Update}, activity::{Create, Delete, Undo, Update},
context, context,
object::{kind::NoteType, properties::ObjectProperties, Note, Tombstone}, object::{kind::NoteType, properties::ObjectProperties, Note},
}; };
use activitystreams_new::object::Tombstone;
use actix_web::Result; use actix_web::Result;
use diesel::PgConnection; use diesel::PgConnection;
use failure::Error; use failure::Error;

View file

@ -21,9 +21,10 @@ use activitystreams::{
actor::{properties::ApActorProperties, Person}, actor::{properties::ApActorProperties, Person},
context, context,
endpoint::EndpointProperties, endpoint::EndpointProperties,
object::{properties::ObjectProperties, AnyImage, Image, Tombstone}, object::{properties::ObjectProperties, AnyImage, Image},
}; };
use activitystreams_ext::Ext2; use activitystreams_ext::Ext2;
use activitystreams_new::object::Tombstone;
use actix_web::{body::Body, web::Path, HttpResponse, Result}; use actix_web::{body::Body, web::Path, HttpResponse, Result};
use diesel::PgConnection; use diesel::PgConnection;
use failure::Error; use failure::Error;