introduce User.maybe_direct_follow() and use it where we used to call User.follow()

This commit is contained in:
William Pitcock 2018-05-25 09:31:42 +00:00
commit e80d91c64a
3 changed files with 32 additions and 0 deletions

View file

@ -25,6 +25,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
def follow(%User{} = follower, params) do
with {:ok, %User{} = followed} <- get_user(params),
{:ok, follower} <- User.maybe_direct_follow(follower, followed),
{:ok, activity} <- ActivityPub.follow(follower, followed) do
{:ok, follower, followed, activity}
else