summaryrefslogtreecommitdiffstats
path: root/users/models
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-25 18:32:45 -0700
committerAndrew Godwin2022-11-25 18:32:45 -0700
commit1cf1f2e5430e1946b6f7520e4d339de82a392c21 (patch)
tree7b98e05795153868fe3a6d53e0633b7b4d8d5684 /users/models
parent5fe5f0495518e43aa4ab9f6831c4bc27a0be9458 (diff)
downloadtakahe-1cf1f2e5430e1946b6f7520e4d339de82a392c21.tar.gz
takahe-1cf1f2e5430e1946b6f7520e4d339de82a392c21.tar.bz2
takahe-1cf1f2e5430e1946b6f7520e4d339de82a392c21.zip
Implement user discoverability
Diffstat (limited to 'users/models')
-rw-r--r--users/models/identity.py6
1 files changed, 5 insertions, 1 deletions
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)