Add proper error message when accessing followers/followings w/ auth

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-02 18:11:27 +01:00
parent c5e7abe3d4
commit 78e3bcb2f8
2 changed files with 159 additions and 33 deletions

View File

@@ -274,6 +274,14 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
end
end
def list_relay_followers(_parent, _args, %{context: %{current_user: %User{}}}) do
{:error, :unauthorized}
end
def list_relay_followers(_parent, _args, _resolution) do
{:error, :unauthenticated}
end
def list_relay_followings(
_parent,
%{page: page, limit: limit},
@@ -288,6 +296,14 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
end
end
def list_relay_followings(_parent, _args, %{context: %{current_user: %User{}}}) do
{:error, :unauthorized}
end
def list_relay_followings(_parent, _args, _resolution) do
{:error, :unauthenticated}
end
def create_relay(_parent, %{address: address}, %{context: %{current_user: %User{role: role}}})
when is_admin(role) do
case Relay.follow(address) do