Handle already following group

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-10-25 13:18:30 +02:00
parent f8eda4aac5
commit f315685deb
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 6 additions and 2 deletions

View File

@ -330,8 +330,12 @@ defmodule Mobilizon.GraphQL.Resolvers.Group do
}) do
case Actors.get_actor(group_id) do
%Actor{type: :Group} = group ->
with {:ok, _activity, %Follower{} = follower} <- Actions.Follow.follow(actor, group) do
{:ok, follower}
case Actions.Follow.follow(actor, group) do
{:ok, _activity, %Follower{} = follower} ->
{:ok, follower}
{:error, :already_following} ->
{:error, dgettext("errors", "You are already following this group")}
end
nil ->