Skip to content

Commit 49318ef

Browse files
committed
return 410 Gone for deleted identity
1 parent f86f3a4 commit 49318ef

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

activities/models/fan_out.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ def handle_new(cls, instance: "FanOut"):
241241
)
242242
except httpx.RequestError:
243243
return
244+
except ValueError:
245+
pass # do not retry if 4xx
244246

245247
# Handle sending identity moved to remote
246248
case (FanOut.Types.identity_moved, False):

users/models/identity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class IdentityStates(StateGraph):
5555

5656
edited = State(try_interval=300, attempt_immediately=True)
5757
deleted = State(try_interval=300, attempt_immediately=True)
58-
deleted_fanned_out = State(delete_after=86400 * 7)
58+
deleted_fanned_out = State(externally_progressed=True)
5959

6060
moved = State(try_interval=300, attempt_immediately=True)
6161
moved_fanned_out = State(externally_progressed=True)
@@ -582,7 +582,7 @@ def to_ap(self):
582582
self.ensure_uris()
583583
response = {
584584
"id": self.actor_uri,
585-
"type": self.actor_type.title(),
585+
"type": "Tombstone" if self.deleted else self.actor_type.title(),
586586
"inbox": self.inbox_uri,
587587
"outbox": self.outbox_uri,
588588
"featured": self.featured_collection_uri,

users/views/identity.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ def serve_actor(self, identity):
6464
# If this not a local actor, redirect to their canonical URI
6565
if not identity.local:
6666
return redirect(identity.actor_uri)
67-
return JsonResponse(
67+
r = JsonResponse(
6868
canonicalise(identity.to_ap(), include_security=True),
6969
content_type="application/activity+json",
7070
)
71+
if identity.deleted:
72+
r.status_code = 410
73+
return r
7174

7275
def get_queryset(self):
7376
return TimelineService(None).identity_public(

0 commit comments

Comments
 (0)