summaryrefslogtreecommitdiffstats
path: root/activities/views
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-22 18:51:01 -0700
committerAndrew Godwin2022-11-22 18:51:01 -0700
commite52c7df498c5f52b9ba9a2ab854d6f06a9b140d7 (patch)
tree04945d246c01502bf771ce94549607dda989b0ba /activities/views
parent7b867b229d2bf925b94181ea74be460b6aeed493 (diff)
downloadtakahe-e52c7df498c5f52b9ba9a2ab854d6f06a9b140d7.tar.gz
takahe-e52c7df498c5f52b9ba9a2ab854d6f06a9b140d7.tar.bz2
takahe-e52c7df498c5f52b9ba9a2ab854d6f06a9b140d7.zip
Add the self-view timeline event on post
Makes it show up for you immediately
Diffstat (limited to 'activities/views')
-rw-r--r--activities/views/posts.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/activities/views/posts.py b/activities/views/posts.py
index de11a09..7950093 100644
--- a/activities/views/posts.py
+++ b/activities/views/posts.py
@@ -3,7 +3,12 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.utils.decorators import method_decorator
from django.views.generic import FormView, TemplateView, View
-from activities.models import Post, PostInteraction, PostInteractionStates
+from activities.models import (
+ Post,
+ PostInteraction,
+ PostInteractionStates,
+ TimelineEvent,
+)
from core.models import Config
from users.decorators import identity_required
from users.shortcuts import by_handle_or_404
@@ -155,10 +160,12 @@ class Compose(FormView):
return form
def form_valid(self, form):
- Post.create_local(
+ post = Post.create_local(
author=self.request.identity,
content=form.cleaned_data["text"],
summary=form.cleaned_data.get("content_warning"),
visibility=form.cleaned_data["visibility"],
)
+ # Add their own timeline event for immediate visibility
+ TimelineEvent.add_post(self.request.identity, post)
return redirect("/")