diff options
author | rinpatch <rinpatch@sdf.org> | 2019-09-14 12:34:21 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-09-14 12:34:21 +0000 |
commit | 90b0bd3984c15b25fde5ae29e23b97a38071fb36 (patch) | |
tree | 32d6ba80629b8a6731c4bf290839f9ac4606d887 /lib | |
parent | 53a3ad60435d4f7eab2dbf1235e5974bac275aa0 (diff) | |
parent | dca545bb0d375601f0b5c355bc2320dacd001363 (diff) | |
download | pleroma-90b0bd3984c15b25fde5ae29e23b97a38071fb36.tar.gz |
Merge branch 'backport/fav-reblog-access-control' into 'maint/1.1'
Backport/fav reblog access control
See merge request pleroma/pleroma!1669
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex index c54462bb3..93ca44d31 100644 --- a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex @@ -842,6 +842,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do def favourited_by(%{assigns: %{user: user}} = conn, %{"id" => id}) do with %Activity{} = activity <- Activity.get_by_id_with_object(id), + {:visible, true} <- {:visible, Visibility.visible_for_user?(activity, user)}, %Object{data: %{"likes" => likes}} <- Object.normalize(activity) do q = from(u in User, where: u.ap_id in ^likes) @@ -853,12 +854,14 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do |> put_view(AccountView) |> render("accounts.json", %{for: user, users: users, as: :user}) else + {:visible, false} -> {:error, :not_found} _ -> json(conn, []) end end def reblogged_by(%{assigns: %{user: user}} = conn, %{"id" => id}) do with %Activity{} = activity <- Activity.get_by_id_with_object(id), + {:visible, true} <- {:visible, Visibility.visible_for_user?(activity, user)}, %Object{data: %{"announcements" => announces}} <- Object.normalize(activity) do q = from(u in User, where: u.ap_id in ^announces) @@ -870,6 +873,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do |> put_view(AccountView) |> render("accounts.json", %{for: user, users: users, as: :user}) else + {:visible, false} -> {:error, :not_found} _ -> json(conn, []) end end |