aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaniini <ariadne@dereferenced.org>2019-07-29 20:10:59 +0000
committerkaniini <ariadne@dereferenced.org>2019-07-29 20:10:59 +0000
commit677df5ceb370a22fa8df44e6ce5f6fa47d91f9b8 (patch)
treed2d55e109f790aa73ba44518840adb2c6c575491
parent66575061851f13355958fd292ee545462bf191c0 (diff)
parent3850812503ebfe0e1eaf84a4067e11e052a8206e (diff)
downloadpleroma-677df5ceb370a22fa8df44e6ce5f6fa47d91f9b8.tar.gz
Merge branch 'security/remote-follow-commonapi' into 'develop'
twitter api: utils: rework do_remote_follow() to use CommonAPI Closes #1138 See merge request pleroma/pleroma!1506
-rw-r--r--lib/pleroma/web/twitter_api/controllers/util_controller.ex7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
index 39bc6147c..5c73a615d 100644
--- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex
+++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
@@ -15,7 +15,6 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
alias Pleroma.Plugs.AuthenticationPlug
alias Pleroma.User
alias Pleroma.Web
- alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.WebFinger
@@ -100,8 +99,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
with %User{} = user <- User.get_cached_by_nickname(username),
true <- AuthenticationPlug.checkpw(password, user.password_hash),
%User{} = _followed <- User.get_cached_by_id(id),
- {:ok, follower} <- User.follow(user, followee),
- {:ok, _activity} <- ActivityPub.follow(follower, followee) do
+ {:ok, _follower, _followee, _activity} <- CommonAPI.follow(user, followee) do
conn
|> render("followed.html", %{error: false})
else
@@ -122,8 +120,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
def do_remote_follow(%{assigns: %{user: user}} = conn, %{"user" => %{"id" => id}}) do
with %User{} = followee <- User.get_cached_by_id(id),
- {:ok, follower} <- User.follow(user, followee),
- {:ok, _activity} <- ActivityPub.follow(follower, followee) do
+ {:ok, _follower, _followee, _activity} <- CommonAPI.follow(user, followee) do
conn
|> render("followed.html", %{error: false})
else