Commit e5206752 authored by kaniini's avatar kaniini
Browse files

activitypub: only send accept back automatically if the account is not locked

parent 3208611b
......@@ -252,6 +252,10 @@ def following?(%User{} = follower, %User{} = followed) do
Enum.member?(follower.following, followed.follower_address)
def locked?(%User{} = user) do["locked"] || false
def get_by_ap_id(ap_id) do
Repo.get_by(User, ap_id: ap_id)
......@@ -137,9 +137,11 @@ def handle_incoming(
with %User{local: true} = followed <- User.get_cached_by_ap_id(followed),
%User{} = follower <- User.get_or_fetch_by_ap_id(follower),
{:ok, activity} <- ActivityPub.follow(follower, followed, id, false) do
if not User.locked?(followed) do
ActivityPub.accept(%{to: [follower.ap_id], actor: followed.ap_id, object: data, local: true})
User.follow(follower, followed)
{:ok, activity}
_e -> :error
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment