mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-25 08:41:00 +00:00
improve 410 gone
This commit is contained in:
parent
02bda3ad9b
commit
bd4bfd4584
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
@ -68,7 +70,7 @@ class ViewIdentity(ListView):
|
||||||
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:
|
if identity.deleted and tz.now() - identity.deleted > tz.timedelta(days=3):
|
||||||
r.status_code = 410
|
r.status_code = 410
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue