summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-17 18:52:00 -0700
committerAndrew Godwin2022-11-17 15:10:09 -0700
commit0851fbd1ec09b142608667bf90ee806e59cafb28 (patch)
treeeb4bfa7e52ef0a66460840747ea83b7685e1a5e8 /users
parent2154e6f02252576d8652e66f26fa4ae635d0f8ee (diff)
downloadtakahe-0851fbd1ec09b142608667bf90ee806e59cafb28.tar.gz
takahe-0851fbd1ec09b142608667bf90ee806e59cafb28.tar.bz2
takahe-0851fbd1ec09b142608667bf90ee806e59cafb28.zip
Add search and better notifications
Diffstat (limited to 'users')
-rw-r--r--users/models/follow.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/users/models/follow.py b/users/models/follow.py
index defe399..d2ee493 100644
--- a/users/models/follow.py
+++ b/users/models/follow.py
@@ -1,6 +1,6 @@
from typing import Optional
-from django.db import models
+from django.db import models, transaction
from core.ld import canonicalise
from core.signatures import HttpSignature
@@ -218,9 +218,14 @@ class Follow(StatorModel):
"""
Handles an incoming follow request
"""
- follow = cls.by_ap(data, create=True)
- # Force it into remote_requested so we send an accept
- follow.transition_perform(FollowStates.remote_requested)
+ from activities.models import TimelineEvent
+
+ with transaction.atomic():
+ follow = cls.by_ap(data, create=True)
+ # Force it into remote_requested so we send an accept
+ follow.transition_perform(FollowStates.remote_requested)
+ # Add a timeline event
+ TimelineEvent.add_follow(follow.target, follow.source)
@classmethod
def handle_accept_ap(cls, data):