Used cached user resources in subscriptions

This commit is contained in:
Sadposter 2019-04-08 15:56:14 +01:00
commit 589629cf3e
No known key found for this signature in database
GPG key ID: 6F3BAD60DE190290
3 changed files with 5 additions and 5 deletions

View file

@ -341,7 +341,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
%Activity{data: %{"actor" => actor, "type" => type}} = activity
)
when type == "Create" do
with %User{} = user <- User.get_by_ap_id(actor) do
with %User{} = user <- User.get_cached_by_ap_id(actor) do
subscriber_ids =
user
|> User.subscribers()

View file

@ -864,7 +864,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end
def subscribe(%{assigns: %{user: user}} = conn, %{"id" => id}) do
with %User{} = subscription_target <- User.get_by_id(id),
with %User{} = subscription_target <- User.get_cached_by_id(id),
{:ok, subscription_target} = User.subscribe(user, subscription_target) do
conn
|> put_view(AccountView)
@ -878,7 +878,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end
def unsubscribe(%{assigns: %{user: user}} = conn, %{"id" => id}) do
with %User{} = subscription_target <- User.get_by_id(id),
with %User{} = subscription_target <- User.get_cached_by_id(id),
{:ok, subscription_target} = User.unsubscribe(user, subscription_target) do
conn
|> put_view(AccountView)