kopia lustrzana https://github.com/jointakahe/takahe
Merge bd4bfd4584
into 7c34ac78ed
commit
11b18a2a57
|
@ -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,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import string
|
import string
|
||||||
|
from datetime import timezone
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
@ -6,6 +7,7 @@ from django.contrib.syndication.views import Feed
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.http import Http404, JsonResponse
|
from django.http import Http404, JsonResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
|
from django.utils import timezone as tz
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.utils.feedgenerator import Rss201rev2Feed
|
from django.utils.feedgenerator import Rss201rev2Feed
|
||||||
from django.utils.xmlutils import SimplerXMLGenerator
|
from django.utils.xmlutils import SimplerXMLGenerator
|
||||||
|
@ -64,10 +66,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 and tz.now() - identity.deleted > tz.timedelta(days=3):
|
||||||
|
r.status_code = 410
|
||||||
|
return r
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return TimelineService(None).identity_public(
|
return TimelineService(None).identity_public(
|
||||||
|
|
Ładowanie…
Reference in New Issue