update activitystreams lib

This commit is contained in:
Felix 2020-04-30 18:30:01 +02:00
parent 770dcbdc49
commit 461114c143
4 changed files with 19 additions and 21 deletions

8
server/Cargo.lock generated vendored
View file

@ -2,9 +2,9 @@
# It is not intended for manual editing.
[[package]]
name = "activitystreams"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae98a55a86fc3150f278b225644cd46b5359f4d75067eae6dc3a52b409c537fb"
checksum = "dd5b29a0f2c64cc56f2b79ec29cab68a9dab3b714d811a55668d072f18a8638e"
dependencies = [
"activitystreams-derive",
"chrono",
@ -17,9 +17,9 @@ dependencies = [
[[package]]
name = "activitystreams-derive"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20d0384ae423a1df266f216e351ce9b40e8d369467d9242c086121154b4327dd"
checksum = "985d3ca1ee226e83f4118e0235bc11d9fce39c4eec8d53739a21b01dd0b3f30f"
dependencies = [
"proc-macro2",
"quote",

2
server/Cargo.toml vendored
View file

@ -8,7 +8,7 @@ edition = "2018"
diesel = { version = "1.4.4", features = ["postgres","chrono","r2d2","64-column-tables","serde_json"] }
diesel_migrations = "1.4.0"
dotenv = "0.15.0"
activitystreams = "0.5.0-alpha.16"
activitystreams = "0.6.0"
bcrypt = "0.6.2"
chrono = { version = "0.4.7", features = ["serde"] }
failure = "0.1.5"

View file

@ -67,7 +67,6 @@ use chrono::NaiveDateTime;
use fetcher::{get_or_fetch_and_upsert_remote_community, get_or_fetch_and_upsert_remote_user};
use signatures::verify;
use signatures::{sign, PublicKey, PublicKeyExtension};
use activitystreams::primitives::XsdString;
type GroupExt = Ext<Ext<Group, ApActorProperties>, PublicKeyExtension>;
type PersonExt = Ext<Ext<Person, ApActorProperties>, PublicKeyExtension>;
@ -171,13 +170,13 @@ fn create_tombstone(
tombstone
.object_props
.set_id(object_id)?
.set_published(convert_datetime(published));
.set_published(convert_datetime(published))?;
if let Some(updated) = updated {
tombstone
.object_props
.set_updated(convert_datetime(updated))?;
}
tombstone.tombstone_props.set_former_type_object_box(XsdString::from_string(former_type))?;
tombstone.tombstone_props.set_former_type_xsd_string(former_type)?;
Ok(tombstone)
} else {
Err(format_err!(

View file

@ -82,7 +82,7 @@ fn receive_create_post(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Page>()?;
.into_concrete::<Page>()?;
let user_uri = create
.create_props
@ -131,7 +131,7 @@ fn receive_create_comment(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Note>()?;
.into_concrete::<Note>()?;
let user_uri = create
.create_props
@ -185,7 +185,7 @@ fn receive_update_post(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Page>()?;
.into_concrete::<Page>()?;
let user_uri = update
.update_props
@ -235,7 +235,7 @@ fn receive_like_post(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Page>()?;
.into_concrete::<Page>()?;
let user_uri = like.like_props.get_actor_xsd_any_uri().unwrap().to_string();
@ -288,7 +288,7 @@ fn receive_dislike_post(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Page>()?;
.into_concrete::<Page>()?;
let user_uri = dislike
.dislike_props
@ -345,7 +345,7 @@ fn receive_update_comment(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Note>()?;
.into_concrete::<Note>()?;
let user_uri = update
.update_props
@ -400,7 +400,7 @@ fn receive_like_comment(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Note>()?;
.into_concrete::<Note>()?;
let user_uri = like.like_props.get_actor_xsd_any_uri().unwrap().to_string();
@ -458,7 +458,7 @@ fn receive_dislike_comment(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Note>()?;
.into_concrete::<Note>()?;
let user_uri = dislike
.dislike_props
@ -520,11 +520,10 @@ fn receive_delete(
.to_owned()
.unwrap()
.to_owned()
.to_concrete::<Tombstone>()?;
// TODO: not sure how to handle formerType (should be a string)
// https://www.w3.org/TR/activitystreams-vocabulary/#dfn-formertype
let former_type: &str = tombstone.tombstone_props.get_former_type_object_box().unwrap().to_concrete::<String>();
match former_type {
.into_concrete::<Tombstone>()?;
let former_type = tombstone.tombstone_props.get_former_type_xsd_string().unwrap().to_string();
// TODO: handle these
match former_type.as_str() {
"Group" => {},
d => return Err(format_err!("Delete type {} not supported", d)),
}