Make sure event and group search only return the correct type
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
ef76c100ba
commit
4896036cd1
|
@ -4,8 +4,9 @@ defmodule Mobilizon.GraphQL.API.Search do
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.ActorType
|
alias Mobilizon.Actors.{Actor, ActorType}
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
|
alias Mobilizon.Events.Event
|
||||||
alias Mobilizon.Storage.Page
|
alias Mobilizon.Storage.Page
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub
|
alias Mobilizon.Federation.ActivityPub
|
||||||
|
@ -26,7 +27,7 @@ defmodule Mobilizon.GraphQL.API.Search do
|
||||||
is_url(term) ->
|
is_url(term) ->
|
||||||
# skip, if it's not an actor
|
# skip, if it's not an actor
|
||||||
case process_from_url(term) do
|
case process_from_url(term) do
|
||||||
%Page{total: _total, elements: _elements} = page ->
|
%Page{total: _total, elements: [%Actor{} = _actor]} = page ->
|
||||||
{:ok, page}
|
{:ok, page}
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
|
@ -60,7 +61,7 @@ defmodule Mobilizon.GraphQL.API.Search do
|
||||||
if is_url(term) do
|
if is_url(term) do
|
||||||
# skip, if it's w not an actor
|
# skip, if it's w not an actor
|
||||||
case process_from_url(term) do
|
case process_from_url(term) do
|
||||||
%Page{total: _total, elements: _elements} = page ->
|
%Page{total: _total, elements: [%Event{} = _event]} = page ->
|
||||||
{:ok, page}
|
{:ok, page}
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
|
|
Loading…
Reference in a new issue