From 4896036cd180abc525c939d68961f8e36298c820 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 2 Oct 2020 16:18:11 +0200 Subject: [PATCH] Make sure event and group search only return the correct type Signed-off-by: Thomas Citharel --- lib/graphql/api/search.ex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/graphql/api/search.ex b/lib/graphql/api/search.ex index dfc579006..77d971859 100644 --- a/lib/graphql/api/search.ex +++ b/lib/graphql/api/search.ex @@ -4,8 +4,9 @@ defmodule Mobilizon.GraphQL.API.Search do """ alias Mobilizon.Actors - alias Mobilizon.Actors.ActorType + alias Mobilizon.Actors.{Actor, ActorType} alias Mobilizon.Events + alias Mobilizon.Events.Event alias Mobilizon.Storage.Page alias Mobilizon.Federation.ActivityPub @@ -26,7 +27,7 @@ defmodule Mobilizon.GraphQL.API.Search do is_url(term) -> # skip, if it's not an actor case process_from_url(term) do - %Page{total: _total, elements: _elements} = page -> + %Page{total: _total, elements: [%Actor{} = _actor]} = page -> {:ok, page} _ -> @@ -60,7 +61,7 @@ defmodule Mobilizon.GraphQL.API.Search do if is_url(term) do # skip, if it's w not an actor case process_from_url(term) do - %Page{total: _total, elements: _elements} = page -> + %Page{total: _total, elements: [%Event{} = _event]} = page -> {:ok, page} _ ->