return 410 Gone for deleted identity

This commit is contained in:
Henri Dickson 2024-01-19 00:35:30 -05:00
parent 7c34ac78ed
commit 02bda3ad9b
2 changed files with 6 additions and 3 deletions

View file

@ -55,7 +55,7 @@ class IdentityStates(StateGraph):
edited = State(try_interval=300, attempt_immediately=True) edited = State(try_interval=300, attempt_immediately=True)
deleted = State(try_interval=300, attempt_immediately=True) deleted = State(try_interval=300, attempt_immediately=True)
deleted_fanned_out = State(delete_after=86400 * 7) deleted_fanned_out = State(externally_progressed=True)
moved = State(try_interval=300, attempt_immediately=True) moved = State(try_interval=300, attempt_immediately=True)
moved_fanned_out = State(externally_progressed=True) moved_fanned_out = State(externally_progressed=True)
@ -582,7 +582,7 @@ class Identity(StatorModel):
self.ensure_uris() self.ensure_uris()
response = { response = {
"id": self.actor_uri, "id": self.actor_uri,
"type": self.actor_type.title(), "type": "Tombstone" if self.deleted else self.actor_type.title(),
"inbox": self.inbox_uri, "inbox": self.inbox_uri,
"outbox": self.outbox_uri, "outbox": self.outbox_uri,
"featured": self.featured_collection_uri, "featured": self.featured_collection_uri,

View file

@ -64,10 +64,13 @@ class ViewIdentity(ListView):
# If this not a local actor, redirect to their canonical URI # If this not a local actor, redirect to their canonical URI
if not identity.local: if not identity.local:
return redirect(identity.actor_uri) return redirect(identity.actor_uri)
return JsonResponse( r = JsonResponse(
canonicalise(identity.to_ap(), include_security=True), canonicalise(identity.to_ap(), include_security=True),
content_type="application/activity+json", content_type="application/activity+json",
) )
if identity.deleted:
r.status_code = 410
return r
def get_queryset(self): def get_queryset(self):
return TimelineService(None).identity_public( return TimelineService(None).identity_public(