cleanup legacy code

This commit is contained in:
Your Name 2024-06-07 22:43:28 -04:00 committed by Henri Dickson
parent 0fbaaaea43
commit c0802c9c04
4 changed files with 6 additions and 32 deletions

View file

@ -147,12 +147,14 @@ class DiscoverGenerator(BaseJob):
"pk", flat=True "pk", flat=True
)[:20] )[:20]
) )
print(post_ids)
if len(post_ids) < 30: if len(post_ids) < 30:
post_ids |= set( post_ids |= set(
Takahe.get_popular_posts(3, 1) Comment.objects.filter(visibility=0)
.order_by("-published") .order_by("-created_time")
.values_list("pk", flat=True)[:2] .values_list("posts", flat=True)[:2]
) )
print(post_ids)
cache.set("public_gallery", gallery_list, timeout=None) cache.set("public_gallery", gallery_list, timeout=None)
cache.set("trends_links", trends, timeout=None) cache.set("trends_links", trends, timeout=None)
cache.set("featured_collections", collection_ids, timeout=None) cache.set("featured_collections", collection_ids, timeout=None)

View file

@ -1 +0,0 @@
from .decorators import *

View file

@ -1,27 +0,0 @@
import functools
from django.http import HttpResponse
from django.shortcuts import render
from django.utils.translation import gettext_lazy as _
from requests.exceptions import Timeout
def mastodon_request_included(func):
"""Handles timeout exception of requests to mastodon, returns http 500"""
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except (Timeout, ConnectionError):
return render(
args[0],
"common/error.html",
{"msg": _("Timeout connecting to Fediverse.")},
)
return wrapper
class HttpResponseInternalServerError(HttpResponse):
status_code = 500

View file

@ -46,7 +46,7 @@
<article> <article>
{{ announcement.html | safe }} {{ announcement.html | safe }}
<footer> <footer>
<span class="action inline"><span><a>{{ announcement.created|default:announcement.created|naturaldelta }}</a></span> <span class="action inline"><span><a>{{ announcement.created|default:announcement.created|date }}</a></span>
</span> </span>
</footer> </footer>
</article> </article>