aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
diff options
context:
space:
mode:
authorSadposter <hannah+pleroma@coffee-and-dreams.uk>2019-07-23 19:44:47 +0100
committerSadposter <hannah+pleroma@coffee-and-dreams.uk>2019-07-23 19:44:47 +0100
commit54a161cb7ad58da05ced24daaf0c16964f76fa4c (patch)
tree404dd7418cc37d9ff32ddf6c927f08a5a5a543a4 /lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
parentc4005654279fe45213a3d11b6e4767e8afd24850 (diff)
downloadpleroma-54a161cb7ad58da05ced24daaf0c16964f76fa4c.tar.gz
move unauth'd user blocks?/2 check
Diffstat (limited to 'lib/pleroma/web/mastodon_api/mastodon_api_controller.ex')
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex18
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index 9269a5a29..d660f3f05 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -884,14 +884,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
%Object{data: %{"likes" => likes}} <- Object.normalize(object) do
q = from(u in User, where: u.ap_id in ^likes)
- users = Repo.all(q)
-
users =
- if is_nil(user) do
- users
- else
- Enum.filter(users, &(not User.blocks?(user, &1)))
- end
+ Repo.all(q)
+ |> Enum.filter(&(not User.blocks?(user, &1)))
conn
|> put_view(AccountView)
@@ -906,14 +901,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
%Object{data: %{"announcements" => announces}} <- Object.normalize(object) do
q = from(u in User, where: u.ap_id in ^announces)
- users = Repo.all(q)
-
users =
- if is_nil(user) do
- users
- else
- Enum.filter(users, &(not User.blocks?(user, &1)))
- end
+ Repo.all(q)
+ |> Enum.filter(&(not User.blocks?(user, &1)))
conn
|> put_view(AccountView)