diff --git a/lib/graphql/resolvers/event.ex b/lib/graphql/resolvers/event.ex index fe7aaec69..04ab9b8c5 100644 --- a/lib/graphql/resolvers/event.ex +++ b/lib/graphql/resolvers/event.ex @@ -76,7 +76,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do limit: limit, order_by: order_by, direction: direction, - longevents: longevents, + long_events: long_events, location: location, radius: radius }, @@ -84,7 +84,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do ) when limit < @event_max_limit do {:ok, - Events.list_events(page, limit, order_by, direction, true, longevents, location, radius)} + Events.list_events(page, limit, order_by, direction, true, long_events, location, radius)} end def list_events( diff --git a/lib/graphql/schema/event.ex b/lib/graphql/schema/event.ex index e76528cf2..253756319 100644 --- a/lib/graphql/schema/event.ex +++ b/lib/graphql/schema/event.ex @@ -400,7 +400,7 @@ defmodule Mobilizon.GraphQL.Schema.EventType do description: "Direction for the sort" ) - arg(:longevents, :boolean, + arg(:long_events, :boolean, default_value: nil, description: "if mention filter in or out long events" ) diff --git a/lib/graphql/schema/search.ex b/lib/graphql/schema/search.ex index 5325566be..7d8448102 100644 --- a/lib/graphql/schema/search.ex +++ b/lib/graphql/schema/search.ex @@ -287,7 +287,7 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do description: "Radius around the location to search in" ) - arg(:longevents, :boolean, description: "if mention filter in or out long events") + arg(:long_events, :boolean, description: "if mention filter in or out long events") arg(:bbox, :string, description: "The bbox to search events into") arg(:zoom, :integer, description: "The zoom level for searching events") diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex index f05bd0844..b3786952f 100644 --- a/lib/mobilizon/events/events.ex +++ b/lib/mobilizon/events/events.ex @@ -383,7 +383,7 @@ defmodule Mobilizon.Events do sort \\ :begins_on, direction \\ :asc, is_future \\ true, - longevents \\ nil, + long_events \\ nil, location \\ nil, radius \\ nil ) do @@ -394,7 +394,7 @@ defmodule Mobilizon.Events do |> maybe_join_address(%{location: location, radius: radius}) |> events_for_location(%{location: location, radius: radius}) |> filter_future_events(is_future) - |> events_for_longevents(longevents) + |> events_for_long_events(long_events) |> filter_public_visibility() |> filter_draft() |> filter_cancelled_events() @@ -604,7 +604,7 @@ defmodule Mobilizon.Events do |> events_for_search_query() |> events_for_begins_on(Map.get(args, :begins_on, DateTime.utc_now())) |> events_for_ends_on(Map.get(args, :ends_on)) - |> events_for_longevents(Map.get(args, :longevents)) + |> events_for_long_events(Map.get(args, :long_events)) |> events_for_category(args) |> events_for_categories(args) |> events_for_languages(args) @@ -1414,14 +1414,14 @@ defmodule Mobilizon.Events do end end - @spec events_for_longevents(Ecto.Queryable.t(), Boolean.t() | nil) :: Ecto.Query.t() - defp events_for_longevents(query, longevents) do + @spec events_for_long_events(Ecto.Queryable.t(), Boolean.t() | nil) :: Ecto.Query.t() + defp events_for_long_events(query, long_events) do duration = Config.get([:instance, :duration_of_long_event], 0) if duration <= 0 do query else - case longevents do + case long_events do nil -> query diff --git a/schema.graphql b/schema.graphql index 372868580..1e5d1e707 100644 --- a/schema.graphql +++ b/schema.graphql @@ -2268,7 +2268,7 @@ type RootQueryType { endsOn: DateTime "Filter for long events in function of configuration parameter 'duration_of_long_event'" - longevents: Boolean + longEvents: Boolean ): Events "Interact with an URI" diff --git a/src/components/Local/CloseEvents.vue b/src/components/Local/CloseEvents.vue index ae1d303c9..7029f1748 100644 --- a/src/components/Local/CloseEvents.vue +++ b/src/components/Local/CloseEvents.vue @@ -122,7 +122,7 @@ const eventsQuery = useQuery<{ }>(FETCH_EVENTS, () => ({ orderBy: EventSortField.BEGINS_ON, direction: SortDirection.ASC, - longevents: false, + longEvents: false, location: geoHash.value ?? "", radius: distance.value, limit: 93, diff --git a/src/graphql/event.ts b/src/graphql/event.ts index b2bdabaea..8bf036c27 100644 --- a/src/graphql/event.ts +++ b/src/graphql/event.ts @@ -109,7 +109,7 @@ export const FETCH_EVENTS = gql` $direction: SortDirection $page: Int $limit: Int - $longevents: Boolean + $longEvents: Boolean ) { events( location: $location @@ -118,7 +118,7 @@ export const FETCH_EVENTS = gql` direction: $direction page: $page limit: $limit - longevents: $longevents + longEvents: $longEvents ) { total elements { diff --git a/src/graphql/search.ts b/src/graphql/search.ts index 2eff07b5a..fe13db545 100644 --- a/src/graphql/search.ts +++ b/src/graphql/search.ts @@ -33,7 +33,7 @@ export const SEARCH_EVENTS_AND_GROUPS = gql` $searchTarget: SearchTarget $beginsOn: DateTime $endsOn: DateTime - $longevents: Boolean + $longEvents: Boolean $bbox: String $zoom: Int $eventPage: Int @@ -55,7 +55,7 @@ export const SEARCH_EVENTS_AND_GROUPS = gql` searchTarget: $searchTarget beginsOn: $beginsOn endsOn: $endsOn - longevents: $longevents + longEvents: $longEvents bbox: $bbox zoom: $zoom page: $eventPage @@ -155,7 +155,7 @@ export const SEARCH_EVENTS = gql` $endsOn: DateTime $eventPage: Int $limit: Int - $longevents: Boolean + $longEvents: Boolean ) { searchEvents( location: $location @@ -168,7 +168,7 @@ export const SEARCH_EVENTS = gql` endsOn: $endsOn page: $eventPage limit: $limit - longevents: $longevents + longEvents: $longEvents ) { total elements { @@ -218,7 +218,7 @@ export const SEARCH_CALENDAR_EVENTS = gql` endsOn: $endsOn page: $eventPage limit: $limit - longevents: false + longEvents: false ) { total elements { diff --git a/src/views/SearchView.vue b/src/views/SearchView.vue index 955e5bc49..2424306ff 100644 --- a/src/views/SearchView.vue +++ b/src/views/SearchView.vue @@ -1049,7 +1049,7 @@ const { result: searchElementsResult, loading: searchLoading } = useQuery<{ location: geoHashLocation.value, beginsOn: start.value, endsOn: end.value, - longevents: longEvents.value, + longEvents: longEvents.value, radius: geoHashLocation.value ? radius.value : undefined, eventPage: eventPage.value, groupPage: groupPage.value, diff --git a/test/graphql/resolvers/search_test.exs b/test/graphql/resolvers/search_test.exs index 8af96b043..27352e4e2 100644 --- a/test/graphql/resolvers/search_test.exs +++ b/test/graphql/resolvers/search_test.exs @@ -18,8 +18,8 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do describe "search events/3" do @search_events_query """ - query SearchEvents($location: String, $radius: Float, $tags: String, $term: String, $beginsOn: DateTime, $endsOn: DateTime, $longevents:Boolean, $searchTarget: SearchTarget) { - searchEvents(location: $location, radius: $radius, tags: $tags, term: $term, beginsOn: $beginsOn, endsOn: $endsOn, longevents: $longevents, searchTarget: $searchTarget) { + query SearchEvents($location: String, $radius: Float, $tags: String, $term: String, $beginsOn: DateTime, $endsOn: DateTime, $longEvents:Boolean, $searchTarget: SearchTarget) { + searchEvents(location: $location, radius: $radius, tags: $tags, term: $term, beginsOn: $beginsOn, endsOn: $endsOn, longEvents: $longEvents, searchTarget: $searchTarget) { total, elements { id @@ -224,7 +224,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do res = AbsintheHelpers.graphql_query(conn, query: @search_events_query, - variables: %{longevents: false} + variables: %{longEvents: false} ) assert res["errors"] == nil @@ -241,7 +241,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do res = AbsintheHelpers.graphql_query(conn, query: @search_events_query, - variables: %{longevents: true} + variables: %{longEvents: true} ) assert res["errors"] == nil @@ -296,7 +296,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do res = AbsintheHelpers.graphql_query(conn, query: @search_events_query, - variables: %{longevents: false} + variables: %{longEvents: false} ) assert res["errors"] == nil @@ -311,7 +311,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do res = AbsintheHelpers.graphql_query(conn, query: @search_events_query, - variables: %{longevents: true} + variables: %{longEvents: true} ) assert res["errors"] == nil @@ -364,7 +364,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do res = AbsintheHelpers.graphql_query(conn, query: @search_events_query, - variables: %{longevents: false} + variables: %{longEvents: false} ) assert res["errors"] == nil @@ -378,7 +378,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do res = AbsintheHelpers.graphql_query(conn, query: @search_events_query, - variables: %{longevents: true} + variables: %{longEvents: true} ) assert res["errors"] == nil