summaryrefslogtreecommitdiffstats
path: root/server/src/apub/user.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/apub/user.rs')
-rw-r--r--server/src/apub/user.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/server/src/apub/user.rs b/server/src/apub/user.rs
index 323407c7..997c03ea 100644
--- a/server/src/apub/user.rs
+++ b/server/src/apub/user.rs
@@ -1,18 +1,12 @@
use crate::{
api::claims::Claims,
apub::{
- activities::send_activity,
- create_apub_response,
- insert_activity,
- ActorType,
- FromApub,
- PersonExt,
- ToApub,
+ activities::send_activity, create_apub_response, insert_activity, ActorType, FromApub,
+ PersonExt, ToApub,
},
blocking,
routes::DbPoolParam,
- DbPool,
- LemmyError,
+ DbPool, LemmyError,
};
use activitystreams_ext::Ext1;
use activitystreams_new::{
@@ -193,8 +187,8 @@ impl ActorType for User_ {
impl FromApub for UserForm {
type ApubType = PersonExt;
/// Parse an ActivityPub person received from another instance into a Lemmy user.
- async fn from_apub(person: &mut PersonExt, _: &Client, _: &DbPool) -> Result<Self, LemmyError> {
- let avatar = match person.take_icon() {
+ async fn from_apub(person: &PersonExt, _: &Client, _: &DbPool) -> Result<Self, LemmyError> {
+ let avatar = match person.icon() {
Some(any_image) => Image::from_any_base(any_image.as_one().unwrap().clone())
.unwrap()
.unwrap()
@@ -207,19 +201,19 @@ impl FromApub for UserForm {
Ok(UserForm {
name: person
- .take_name()
+ .name()
.unwrap()
.as_single_xsd_string()
.unwrap()
.into(),
- preferred_username: person.inner.take_preferred_username(),
+ preferred_username: person.inner.preferred_username().map(|u| u.to_string()),
password_encrypted: "".to_string(),
admin: false,
banned: false,
email: None,
avatar,
updated: person
- .take_updated()
+ .updated()
.map(|u| u.as_ref().to_owned().naive_local()),
show_nsfw: false,
theme: "".to_string(),
@@ -231,7 +225,7 @@ impl FromApub for UserForm {
matrix_user_id: None,
actor_id: person.id().unwrap().to_string(),
bio: person
- .take_summary()
+ .summary()
.map(|s| s.as_single_xsd_string().unwrap().into()),
local: false,
private_key: None,