aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadposter <hannah+pleroma@coffee-and-dreams.uk>2019-07-23 15:02:18 +0100
committerSadposter <hannah+pleroma@coffee-and-dreams.uk>2019-07-23 15:08:33 +0100
commiteacf61d823f8bc4398dee883aa86171ec4757fe9 (patch)
tree880abbf65db4e8623e3fe68cf7ef4c3cdeee4d30
parenta042a7ac6d65dca3e19e6c4ddd65d2010e94aeba (diff)
downloadpleroma-eacf61d823f8bc4398dee883aa86171ec4757fe9.tar.gz
fix unauthenticated req to favourited/rebloggd_by
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index d660f3f05..ccebcd415 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -884,9 +884,12 @@ 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)
- |> Enum.filter(&(not User.blocks?(user, &1)))
+ users = Repo.all(q)
+ users = if is_nil(user) do
+ users
+ else
+ Enum.filter(users, &(not User.blocks?(user, &1)))
+ end
conn
|> put_view(AccountView)
@@ -901,9 +904,12 @@ 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)
- |> Enum.filter(&(not User.blocks?(user, &1)))
+ users = Repo.all(q)
+ users = if is_nil(user) do
+ users
+ else
+ Enum.filter(users, &(not User.blocks?(user, &1)))
+ end
conn
|> put_view(AccountView)