feat: add discoverable field to ApUser — no longer hard-coded to true

This commit is contained in:
2026-05-29 01:11:55 +02:00
parent 7424d1dc54
commit 4ef1315671
3 changed files with 9 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ pub struct DbActor {
pub profile_url: Option<Url>, pub profile_url: Option<Url>,
pub attachment: Vec<ApProfileField>, pub attachment: Vec<ApProfileField>,
pub manually_approves_followers: bool, pub manually_approves_followers: bool,
pub discoverable: bool,
pub actor_type: ApActorType, pub actor_type: ApActorType,
pub featured_url: Option<Url>, pub featured_url: Option<Url>,
} }
@@ -191,6 +192,7 @@ pub async fn get_local_actor(
profile_url: user.profile_url, profile_url: user.profile_url,
attachment: user.attachment, attachment: user.attachment,
manually_approves_followers: user.manually_approves_followers, manually_approves_followers: user.manually_approves_followers,
discoverable: user.discoverable,
actor_type: user.actor_type, actor_type: user.actor_type,
featured_url: user.featured_url, featured_url: user.featured_url,
}) })
@@ -267,6 +269,7 @@ impl Object for DbActor {
profile_url: user.profile_url, profile_url: user.profile_url,
attachment: user.attachment, attachment: user.attachment,
manually_approves_followers: user.manually_approves_followers, manually_approves_followers: user.manually_approves_followers,
discoverable: user.discoverable,
actor_type: user.actor_type, actor_type: user.actor_type,
featured_url: user.featured_url, featured_url: user.featured_url,
})) }))
@@ -314,7 +317,7 @@ impl Object for DbActor {
summary: self.bio.clone(), summary: self.bio.clone(),
icon, icon,
url: self.profile_url, url: self.profile_url,
discoverable: Some(true), discoverable: Some(self.discoverable),
manually_approves_followers: self.manually_approves_followers, manually_approves_followers: self.manually_approves_followers,
updated: Some(self.last_refreshed_at), updated: Some(self.last_refreshed_at),
endpoints: Some(Endpoints { shared_inbox }), endpoints: Some(Endpoints { shared_inbox }),
@@ -404,6 +407,7 @@ impl Object for DbActor {
}) })
.collect(), .collect(),
manually_approves_followers: json.manually_approves_followers, manually_approves_followers: json.manually_approves_followers,
discoverable: json.discoverable.unwrap_or(false),
actor_type: json.kind, actor_type: json.kind,
featured_url: json.featured, featured_url: json.featured,
}) })

View File

@@ -94,6 +94,7 @@ impl MemUserRepo {
profile_url: None, profile_url: None,
attachment: vec![], attachment: vec![],
manually_approves_followers: true, manually_approves_followers: true,
discoverable: true,
actor_type: ApActorType::Person, actor_type: ApActorType::Person,
featured_url: None, featured_url: None,
}); });

View File

@@ -56,6 +56,9 @@ pub struct ApUser {
/// If true, incoming Follow requests must be manually approved before the /// If true, incoming Follow requests must be manually approved before the
/// actor is listed as `manuallyApprovesFollowers=true` in AP JSON. /// actor is listed as `manuallyApprovesFollowers=true` in AP JSON.
pub manually_approves_followers: bool, pub manually_approves_followers: bool,
/// Whether this actor should appear in AP directory listings.
/// Serialized as `discoverable` in actor JSON. Defaults to `true`.
pub discoverable: bool,
/// AP actor type serialized in the actor JSON. Defaults to `Person`. /// AP actor type serialized in the actor JSON. Defaults to `Person`.
pub actor_type: ApActorType, pub actor_type: ApActorType,
/// URL of the `featured` (pinned posts) collection. Set to expose a pinned /// URL of the `featured` (pinned posts) collection. Set to expose a pinned