1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-22 07:52:43 +00:00

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

View file

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