diff options
author | Andrew Godwin | 2022-11-17 18:52:00 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-17 15:10:09 -0700 |
commit | 0851fbd1ec09b142608667bf90ee806e59cafb28 (patch) | |
tree | eb4bfa7e52ef0a66460840747ea83b7685e1a5e8 /users/models | |
parent | 2154e6f02252576d8652e66f26fa4ae635d0f8ee (diff) | |
download | takahe-0851fbd1ec09b142608667bf90ee806e59cafb28.tar.gz takahe-0851fbd1ec09b142608667bf90ee806e59cafb28.tar.bz2 takahe-0851fbd1ec09b142608667bf90ee806e59cafb28.zip |
Add search and better notifications
Diffstat (limited to 'users/models')
-rw-r--r-- | users/models/follow.py | 13 |
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): |