]> Untitled Git - lemmy.git/commitdiff
Merge branch 'federated_embeds' into federation
authorDessalines <tyhou13@gmx.com>
Mon, 25 May 2020 20:15:23 +0000 (16:15 -0400)
committerDessalines <tyhou13@gmx.com>
Mon, 25 May 2020 20:15:23 +0000 (16:15 -0400)
1  2 
server/src/apub/fetcher.rs
server/src/apub/post.rs
server/src/apub/user.rs

Simple merge
index 23f18a5c58118bb53c91ee6f0f75c232a07b3f8b,d32ba3ae122899d6e7fa213cdd2794177ec45097..9ee0429808ae44c64d94f225a75b8432fc3cfea9
@@@ -1,39 -1,4 +1,41 @@@
 -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 {
index a2958b159dd30bad2acf5a8d0dbc23c599c4b9a7,395dda9cbd52b1ed093f1a1ef0a725dd6d9559a2..0a651d1fe356c80140778b4b2efe9e2db230df73
@@@ -1,33 -1,4 +1,33 @@@
 -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 {
@@@ -177,10 -157,20 +186,20 @@@ impl FromApub for UserForm 
    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()),