Search should return only groups, don't show user profiles

Closes #845

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-08-23 10:34:33 +02:00
parent 89da83dce4
commit 24ff99ffaf
2 changed files with 10 additions and 4 deletions

View File

@@ -94,9 +94,13 @@ defmodule Mobilizon.GraphQL.API.Search do
@spec process_from_username(String.t()) :: Page.t()
defp process_from_username(search) do
case ActivityPubActor.find_or_make_actor_from_nickname(search) do
{:ok, actor} ->
{:ok, %Actor{type: :Group} = actor} ->
%Page{total: 1, elements: [actor]}
# Don't return anything else than groups
{:ok, %Actor{}} ->
%Page{total: 0, elements: []}
{:error, _err} ->
Logger.debug(fn -> "Unable to find or make actor '#{search}'" end)