-use super::*;
+use crate::{
+ apub::{
+ activities::{populate_object_props, send_activity},
+ create_apub_response,
+ create_apub_tombstone_response,
+ create_tombstone,
+ extensions::page_extension::PageExtension,
+ fetcher::{get_or_fetch_and_upsert_remote_community, get_or_fetch_and_upsert_remote_user},
++ get_apub_protocol_string,
+ ActorType,
+ ApubLikeableType,
+ ApubObjectType,
+ FromApub,
+ PageExt,
+ ToApub,
+ },
+ convert_datetime,
+ db::{
+ activity::insert_activity,
+ community::Community,
+ post::{Post, PostForm},
+ user::User_,
+ Crud,
+ },
+ routes::DbPoolParam,
++ Settings,
+};
+use activitystreams::{
+ activity::{Create, Delete, Dislike, Like, Remove, Undo, Update},
+ context,
- object::{kind::PageType, properties::ObjectProperties, Page, Tombstone},
++ object::{kind::PageType, properties::ObjectProperties, AnyImage, Image, Page, Tombstone},
+ BaseBox,
+};
+use activitystreams_ext::Ext1;
+use actix_web::{body::Body, web::Path, HttpResponse, Result};
+use diesel::PgConnection;
+use failure::Error;
+use serde::Deserialize;
#[derive(Deserialize)]
pub struct PostQuery {
-use super::*;
+use crate::{
+ apub::{
+ activities::send_activity,
+ create_apub_response,
+ extensions::signatures::PublicKey,
+ ActorType,
+ FromApub,
+ PersonExt,
+ ToApub,
+ },
+ convert_datetime,
+ db::{
+ activity::insert_activity,
+ user::{UserForm, User_},
+ },
+ naive_now,
+ routes::DbPoolParam,
+};
+use activitystreams::{
+ activity::{Follow, Undo},
+ actor::{properties::ApActorProperties, Person},
+ context,
+ endpoint::EndpointProperties,
- object::{properties::ObjectProperties, Tombstone},
++ object::{properties::ObjectProperties, AnyImage, Image, Tombstone},
+};
+use activitystreams_ext::Ext2;
+use actix_web::{body::Body, web::Path, HttpResponse, Result};
+use diesel::PgConnection;
+use failure::Error;
+use serde::Deserialize;
#[derive(Deserialize)]
pub struct UserQuery {
type ApubType = PersonExt;
/// Parse an ActivityPub person received from another instance into a Lemmy user.
fn from_apub(person: &PersonExt, _conn: &PgConnection) -> Result<Self, Error> {
- let oprops = &person.base.base.object_props;
- let aprops = &person.base.extension;
- let public_key: &PublicKey = &person.extension.public_key;
+ let oprops = &person.inner.object_props;
+ let aprops = &person.ext_one;
+ let public_key: &PublicKey = &person.ext_two.public_key;
+ let avatar = match oprops.get_icon_any_image() {
+ Some(any_image) => any_image
+ .to_owned()
+ .into_concrete::<Image>()?
+ .object_props
+ .get_url_xsd_any_uri()
+ .map(|u| u.to_string()),
+ None => None,
+ };
+
Ok(UserForm {
name: oprops.get_name_xsd_string().unwrap().to_string(),
preferred_username: aprops.get_preferred_username().map(|u| u.to_string()),