From 1cf1f2e5430e1946b6f7520e4d339de82a392c21 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 25 Nov 2022 18:32:45 -0700 Subject: Implement user discoverability --- users/models/identity.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'users/models') diff --git a/users/models/identity.py b/users/models/identity.py index 7730c8f..5d7fd0b 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -67,6 +67,7 @@ class Identity(StatorModel): name = models.CharField(max_length=500, blank=True, null=True) summary = models.TextField(blank=True, null=True) manually_approves_followers = models.BooleanField(blank=True, null=True) + discoverable = models.BooleanField(default=True) profile_uri = models.CharField(max_length=500, blank=True, null=True) inbox_uri = models.CharField(max_length=500, blank=True, null=True) @@ -240,7 +241,7 @@ class Identity(StatorModel): }, "published": self.created.strftime("%Y-%m-%dT%H:%M:%SZ"), "url": self.absolute_profile_uri(), - "discoverable": True, + "http://joinmastodon.org/ns#discoverable": self.discoverable, } if self.name: response["name"] = self.name @@ -373,6 +374,9 @@ class Identity(StatorModel): self.public_key_id = document.get("publicKey", {}).get("id") self.icon_uri = document.get("icon", {}).get("url") self.image_uri = document.get("image", {}).get("url") + self.discoverable = document.get( + "http://joinmastodon.org/ns#discoverable", True + ) # Now go do webfinger with that info to see if we can get a canonical domain actor_url_parts = urlparse(self.actor_uri) get_domain = sync_to_async(Domain.get_remote_domain) -- cgit v1.2.3