Add follow notifications for local follows too

Fixes #326
This commit is contained in:
Andrew Godwin 2022-12-30 10:19:26 -07:00
parent 7eff751224
commit 52b4384cd6
1 changed files with 3 additions and 0 deletions

View File

@ -144,6 +144,8 @@ class Follow(StatorModel):
Creates a Follow from a local Identity to the target Creates a Follow from a local Identity to the target
(which can be local or remote). (which can be local or remote).
""" """
from activities.models import TimelineEvent
if not source.local: if not source.local:
raise ValueError("You cannot initiate follows from a remote Identity") raise ValueError("You cannot initiate follows from a remote Identity")
try: try:
@ -154,6 +156,7 @@ class Follow(StatorModel):
# TODO: Local follow approvals # TODO: Local follow approvals
if target.local: if target.local:
follow.state = FollowStates.accepted follow.state = FollowStates.accepted
TimelineEvent.add_follow(follow.target, follow.source)
follow.save() follow.save()
return follow return follow