diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 127a6fd..0054f93 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1156,6 +1156,10 @@ components: description: The location of the user's profile page. type: string example: https://example.com/@user + locked: + description: Whether the actor manually approves follow requests. + type: boolean + example: false identity_proofs: description: Identity proofs. type: array diff --git a/src/activitypub/actors/types.rs b/src/activitypub/actors/types.rs index f693de3..3405e76 100644 --- a/src/activitypub/actors/types.rs +++ b/src/activitypub/actors/types.rs @@ -148,6 +148,9 @@ pub struct Actor { #[serde(skip_serializing_if = "Option::is_none")] pub attachment: Option>, + #[serde(default)] + pub manually_approves_followers: bool, + #[serde(skip_serializing_if = "Option::is_none")] pub url: Option, } @@ -329,6 +332,7 @@ pub fn get_local_actor( summary: user.profile.bio.clone(), also_known_as: None, attachment: Some(attachments), + manually_approves_followers: false, url: Some(actor_id), }; Ok(actor) @@ -366,6 +370,7 @@ pub fn get_instance_actor( summary: None, also_known_as: None, attachment: None, + manually_approves_followers: false, url: None, }; Ok(actor) diff --git a/src/mastodon_api/accounts/types.rs b/src/mastodon_api/accounts/types.rs index 52a3230..3ed6d0e 100644 --- a/src/mastodon_api/accounts/types.rs +++ b/src/mastodon_api/accounts/types.rs @@ -58,6 +58,7 @@ pub struct Account { pub note: Option, pub avatar: Option, pub header: Option, + pub locked: bool, pub identity_proofs: Vec, pub payment_options: Vec, pub fields: Vec, @@ -76,6 +77,9 @@ impl Account { .map(|name| get_file_url(instance_url, name)); let header_url = profile.banner_file_name.as_ref() .map(|name| get_file_url(instance_url, name)); + let is_locked = profile.actor_json + .map(|actor| actor.manually_approves_followers) + .unwrap_or(false); let mut identity_proofs = vec![]; for proof in profile.identity_proofs.clone().into_inner() { @@ -141,6 +145,7 @@ impl Account { note: profile.bio, avatar: avatar_url, header: header_url, + locked: is_locked, identity_proofs, payment_options, fields: extra_fields,