Skip to content

Commit

Permalink
return 410 Gone for deleted identity
Browse files Browse the repository at this point in the history
  • Loading branch information
alphatownsman committed Jan 19, 2024
1 parent f86f3a4 commit e04a22d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions users/models/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class IdentityStates(StateGraph):

edited = 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_fanned_out = State(externally_progressed=True)
Expand Down Expand Up @@ -582,7 +582,7 @@ def to_ap(self):
self.ensure_uris()
response = {
"id": self.actor_uri,
"type": self.actor_type.title(),
"type": "Tombstone" if self.deleted else self.actor_type.title(),
"inbox": self.inbox_uri,
"outbox": self.outbox_uri,
"featured": self.featured_collection_uri,
Expand Down
5 changes: 4 additions & 1 deletion users/views/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ def serve_actor(self, identity):
# If this not a local actor, redirect to their canonical URI
if not identity.local:
return redirect(identity.actor_uri)
return JsonResponse(
r = JsonResponse(
canonicalise(identity.to_ap(), include_security=True),
content_type="application/activity+json",
)
if identity.deleted:
r.status_code = 410
return r

def get_queryset(self):
return TimelineService(None).identity_public(
Expand Down

0 comments on commit e04a22d

Please sign in to comment.