summaryrefslogtreecommitdiffstats
path: root/activities/views
diff options
context:
space:
mode:
authorMichael Manfre2022-12-05 12:55:30 -0500
committerGitHub2022-12-05 10:55:30 -0700
commitd6eb16a398a8d3a2f58399fd40df7f212680cab0 (patch)
tree5561d7c7d33850672e300ba4320ece1e588dbb1b /activities/views
parenta9bb4a7122df6d9d4a764de52244c6ec75789ead (diff)
downloadtakahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.tar.gz
takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.tar.bz2
takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.zip
Added caching and initial settings
Diffstat (limited to 'activities/views')
-rw-r--r--activities/views/follows.py4
-rw-r--r--activities/views/posts.py2
-rw-r--r--activities/views/timelines.py14
3 files changed, 20 insertions, 0 deletions
diff --git a/activities/views/follows.py b/activities/views/follows.py
index 44d8adc..841c8cc 100644
--- a/activities/views/follows.py
+++ b/activities/views/follows.py
@@ -1,11 +1,15 @@
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
+from core.decorators import per_identity_cache_page
from users.decorators import identity_required
from users.models import FollowStates
@method_decorator(identity_required, name="dispatch")
+@method_decorator(
+ per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch"
+)
class FollowsPage(TemplateView):
"""
Shows followers/follows.
diff --git a/activities/views/posts.py b/activities/views/posts.py
index ef16713..60873a7 100644
--- a/activities/views/posts.py
+++ b/activities/views/posts.py
@@ -6,11 +6,13 @@ from django.utils.decorators import method_decorator
from django.views.generic import TemplateView, View
from activities.models import Post, PostInteraction, PostInteractionStates, PostStates
+from core.decorators import per_identity_cache_page
from core.ld import canonicalise
from users.decorators import identity_required
from users.shortcuts import by_handle_or_404
+@method_decorator(per_identity_cache_page("cache_timeout_page_post"), name="dispatch")
class Individual(TemplateView):
template_name = "activities/post.html"
diff --git a/activities/views/timelines.py b/activities/views/timelines.py
index 753add6..156a20d 100644
--- a/activities/views/timelines.py
+++ b/activities/views/timelines.py
@@ -5,11 +5,13 @@ from django.utils.decorators import method_decorator
from django.views.generic import FormView, ListView
from activities.models import Hashtag, Post, PostInteraction, TimelineEvent
+from core.decorators import per_identity_cache_page
from core.models import Config
from users.decorators import identity_required
@method_decorator(identity_required, name="dispatch")
+@method_decorator(per_identity_cache_page(), name="dispatch")
class Home(FormView):
template_name = "activities/home.html"
@@ -61,6 +63,9 @@ class Home(FormView):
return redirect(".")
+@method_decorator(
+ per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch"
+)
class Tag(ListView):
template_name = "activities/tag.html"
@@ -96,6 +101,9 @@ class Tag(ListView):
return context
+@method_decorator(
+ per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch"
+)
class Local(ListView):
template_name = "activities/local.html"
@@ -122,6 +130,9 @@ class Local(ListView):
@method_decorator(identity_required, name="dispatch")
+@method_decorator(
+ per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch"
+)
class Federated(ListView):
template_name = "activities/federated.html"
@@ -150,6 +161,9 @@ class Federated(ListView):
@method_decorator(identity_required, name="dispatch")
+@method_decorator(
+ per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch"
+)
class Notifications(ListView):
template_name = "activities/notifications.html"