]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/protocol/objects/person.rs
Diesel 2.0.0 upgrade (#2452)
[lemmy.git] / crates / apub / src / protocol / objects / person.rs
index e45ea78c7af2f232ffc23fa68384a539bc4ad33d..eb473250357984e0928c0f637ebee37145f41188 100644 (file)
@@ -2,16 +2,20 @@ use crate::{
   objects::person::ApubPerson,
   protocol::{objects::Endpoints, ImageObject, Source},
 };
-use activitystreams::{unparsed::Unparsed, url::Url};
+use activitypub_federation::{
+  core::{object_id::ObjectId, signatures::PublicKey},
+  deser::helpers::deserialize_skip_error,
+};
 use chrono::{DateTime, FixedOffset};
-use lemmy_apub_lib::{object_id::ObjectId, signatures::PublicKey};
 use serde::{Deserialize, Serialize};
 use serde_with::skip_serializing_none;
+use url::Url;
 
-#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
+#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
 pub enum UserTypes {
   Person,
   Service,
+  Organization,
 }
 
 #[skip_serializing_none]
@@ -21,24 +25,24 @@ pub struct Person {
   #[serde(rename = "type")]
   pub(crate) kind: UserTypes,
   pub(crate) id: ObjectId<ApubPerson>,
-  /// username, set at account creation and can never be changed
+  /// username, set at account creation and usually fixed after that
   pub(crate) preferred_username: String,
-  /// displayname (can be changed at any time)
+  pub(crate) inbox: Url,
+  /// mandatory field in activitypub, lemmy currently serves an empty outbox
+  pub(crate) outbox: Url,
+  pub(crate) public_key: PublicKey,
+
+  /// displayname
   pub(crate) name: Option<String>,
   pub(crate) summary: Option<String>,
+  #[serde(deserialize_with = "deserialize_skip_error", default)]
   pub(crate) source: Option<Source>,
   /// user avatar
   pub(crate) icon: Option<ImageObject>,
   /// user banner
   pub(crate) image: Option<ImageObject>,
   pub(crate) matrix_user_id: Option<String>,
-  pub(crate) inbox: Url,
-  /// mandatory field in activitypub, currently empty in lemmy
-  pub(crate) outbox: Url,
-  pub(crate) endpoints: Endpoints,
-  pub(crate) public_key: PublicKey,
+  pub(crate) endpoints: Option<Endpoints>,
   pub(crate) published: Option<DateTime<FixedOffset>>,
   pub(crate) updated: Option<DateTime<FixedOffset>>,
-  #[serde(flatten)]
-  pub(crate) unparsed: Unparsed,
 }