diff --git a/src/actors.rs b/src/actors.rs index 7cd4996..56abfa7 100644 --- a/src/actors.rs +++ b/src/actors.rs @@ -38,6 +38,7 @@ pub struct DbActor { pub profile_url: Option, pub attachment: Vec, pub manually_approves_followers: bool, + pub discoverable: bool, pub actor_type: ApActorType, pub featured_url: Option, } @@ -191,6 +192,7 @@ pub async fn get_local_actor( profile_url: user.profile_url, attachment: user.attachment, manually_approves_followers: user.manually_approves_followers, + discoverable: user.discoverable, actor_type: user.actor_type, featured_url: user.featured_url, }) @@ -267,6 +269,7 @@ impl Object for DbActor { profile_url: user.profile_url, attachment: user.attachment, manually_approves_followers: user.manually_approves_followers, + discoverable: user.discoverable, actor_type: user.actor_type, featured_url: user.featured_url, })) @@ -314,7 +317,7 @@ impl Object for DbActor { summary: self.bio.clone(), icon, url: self.profile_url, - discoverable: Some(true), + discoverable: Some(self.discoverable), manually_approves_followers: self.manually_approves_followers, updated: Some(self.last_refreshed_at), endpoints: Some(Endpoints { shared_inbox }), @@ -404,6 +407,7 @@ impl Object for DbActor { }) .collect(), manually_approves_followers: json.manually_approves_followers, + discoverable: json.discoverable.unwrap_or(false), actor_type: json.kind, featured_url: json.featured, }) diff --git a/src/tests/integration.rs b/src/tests/integration.rs index 703e6a7..ce74742 100644 --- a/src/tests/integration.rs +++ b/src/tests/integration.rs @@ -94,6 +94,7 @@ impl MemUserRepo { profile_url: None, attachment: vec![], manually_approves_followers: true, + discoverable: true, actor_type: ApActorType::Person, featured_url: None, }); diff --git a/src/user.rs b/src/user.rs index a3cd2f5..9be046a 100644 --- a/src/user.rs +++ b/src/user.rs @@ -56,6 +56,9 @@ pub struct ApUser { /// If true, incoming Follow requests must be manually approved before the /// actor is listed as `manuallyApprovesFollowers=true` in AP JSON. 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`. pub actor_type: ApActorType, /// URL of the `featured` (pinned posts) collection. Set to expose a pinned