Support manuallyApprovesFollowers property on actor objects

This commit is contained in:
silverpill 2022-12-14 09:24:12 +00:00
parent 53d9b2efa8
commit 68f7b046a1
3 changed files with 14 additions and 0 deletions

View file

@ -1156,6 +1156,10 @@ components:
description: The location of the user's profile page. description: The location of the user's profile page.
type: string type: string
example: https://example.com/@user example: https://example.com/@user
locked:
description: Whether the actor manually approves follow requests.
type: boolean
example: false
identity_proofs: identity_proofs:
description: Identity proofs. description: Identity proofs.
type: array type: array

View file

@ -148,6 +148,9 @@ pub struct Actor {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub attachment: Option<Vec<ActorAttachment>>, pub attachment: Option<Vec<ActorAttachment>>,
#[serde(default)]
pub manually_approves_followers: bool,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>, pub url: Option<String>,
} }
@ -329,6 +332,7 @@ pub fn get_local_actor(
summary: user.profile.bio.clone(), summary: user.profile.bio.clone(),
also_known_as: None, also_known_as: None,
attachment: Some(attachments), attachment: Some(attachments),
manually_approves_followers: false,
url: Some(actor_id), url: Some(actor_id),
}; };
Ok(actor) Ok(actor)
@ -366,6 +370,7 @@ pub fn get_instance_actor(
summary: None, summary: None,
also_known_as: None, also_known_as: None,
attachment: None, attachment: None,
manually_approves_followers: false,
url: None, url: None,
}; };
Ok(actor) Ok(actor)

View file

@ -58,6 +58,7 @@ pub struct Account {
pub note: Option<String>, pub note: Option<String>,
pub avatar: Option<String>, pub avatar: Option<String>,
pub header: Option<String>, pub header: Option<String>,
pub locked: bool,
pub identity_proofs: Vec<AccountField>, pub identity_proofs: Vec<AccountField>,
pub payment_options: Vec<AccountPaymentOption>, pub payment_options: Vec<AccountPaymentOption>,
pub fields: Vec<AccountField>, pub fields: Vec<AccountField>,
@ -76,6 +77,9 @@ impl Account {
.map(|name| get_file_url(instance_url, name)); .map(|name| get_file_url(instance_url, name));
let header_url = profile.banner_file_name.as_ref() let header_url = profile.banner_file_name.as_ref()
.map(|name| get_file_url(instance_url, name)); .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![]; let mut identity_proofs = vec![];
for proof in profile.identity_proofs.clone().into_inner() { for proof in profile.identity_proofs.clone().into_inner() {
@ -141,6 +145,7 @@ impl Account {
note: profile.bio, note: profile.bio,
avatar: avatar_url, avatar: avatar_url,
header: header_url, header: header_url,
locked: is_locked,
identity_proofs, identity_proofs,
payment_options, payment_options,
fields: extra_fields, fields: extra_fields,