merge-upstream-5.0.1 #66
|
@ -76,7 +76,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
|
||||||
limit: limit,
|
limit: limit,
|
||||||
order_by: order_by,
|
order_by: order_by,
|
||||||
direction: direction,
|
direction: direction,
|
||||||
longevents: longevents,
|
long_events: long_events,
|
||||||
location: location,
|
location: location,
|
||||||
radius: radius
|
radius: radius
|
||||||
},
|
},
|
||||||
|
@ -84,7 +84,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
|
||||||
)
|
)
|
||||||
when limit < @event_max_limit do
|
when limit < @event_max_limit do
|
||||||
{:ok,
|
{: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
|
end
|
||||||
|
|
||||||
def list_events(
|
def list_events(
|
||||||
|
|
|
@ -400,7 +400,7 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
|
||||||
description: "Direction for the sort"
|
description: "Direction for the sort"
|
||||||
)
|
)
|
||||||
|
|
||||||
arg(:longevents, :boolean,
|
arg(:long_events, :boolean,
|
||||||
default_value: nil,
|
default_value: nil,
|
||||||
description: "if mention filter in or out long events"
|
description: "if mention filter in or out long events"
|
||||||
)
|
)
|
||||||
|
|
|
@ -287,7 +287,7 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do
|
||||||
description: "Radius around the location to search in"
|
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(:bbox, :string, description: "The bbox to search events into")
|
||||||
arg(:zoom, :integer, description: "The zoom level for searching events")
|
arg(:zoom, :integer, description: "The zoom level for searching events")
|
||||||
|
|
|
@ -383,7 +383,7 @@ defmodule Mobilizon.Events do
|
||||||
sort \\ :begins_on,
|
sort \\ :begins_on,
|
||||||
direction \\ :asc,
|
direction \\ :asc,
|
||||||
is_future \\ true,
|
is_future \\ true,
|
||||||
longevents \\ nil,
|
long_events \\ nil,
|
||||||
location \\ nil,
|
location \\ nil,
|
||||||
radius \\ nil
|
radius \\ nil
|
||||||
) do
|
) do
|
||||||
|
@ -394,7 +394,7 @@ defmodule Mobilizon.Events do
|
||||||
|> maybe_join_address(%{location: location, radius: radius})
|
|> maybe_join_address(%{location: location, radius: radius})
|
||||||
|> events_for_location(%{location: location, radius: radius})
|
|> events_for_location(%{location: location, radius: radius})
|
||||||
|> filter_future_events(is_future)
|
|> filter_future_events(is_future)
|
||||||
|> events_for_longevents(longevents)
|
|> events_for_long_events(long_events)
|
||||||
|> filter_public_visibility()
|
|> filter_public_visibility()
|
||||||
|> filter_draft()
|
|> filter_draft()
|
||||||
|> filter_cancelled_events()
|
|> filter_cancelled_events()
|
||||||
|
@ -604,7 +604,7 @@ defmodule Mobilizon.Events do
|
||||||
|> events_for_search_query()
|
|> events_for_search_query()
|
||||||
|> events_for_begins_on(Map.get(args, :begins_on, DateTime.utc_now()))
|
|> events_for_begins_on(Map.get(args, :begins_on, DateTime.utc_now()))
|
||||||
|> events_for_ends_on(Map.get(args, :ends_on))
|
|> 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_category(args)
|
||||||
|> events_for_categories(args)
|
|> events_for_categories(args)
|
||||||
|> events_for_languages(args)
|
|> events_for_languages(args)
|
||||||
|
@ -1414,14 +1414,14 @@ defmodule Mobilizon.Events do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec events_for_longevents(Ecto.Queryable.t(), Boolean.t() | nil) :: Ecto.Query.t()
|
@spec events_for_long_events(Ecto.Queryable.t(), Boolean.t() | nil) :: Ecto.Query.t()
|
||||||
defp events_for_longevents(query, longevents) do
|
defp events_for_long_events(query, long_events) do
|
||||||
duration = Config.get([:instance, :duration_of_long_event], 0)
|
duration = Config.get([:instance, :duration_of_long_event], 0)
|
||||||
|
|
||||||
if duration <= 0 do
|
if duration <= 0 do
|
||||||
query
|
query
|
||||||
else
|
else
|
||||||
case longevents do
|
case long_events do
|
||||||
nil ->
|
nil ->
|
||||||
query
|
query
|
||||||
|
|
||||||
|
|
|
@ -2268,7 +2268,7 @@ type RootQueryType {
|
||||||
endsOn: DateTime
|
endsOn: DateTime
|
||||||
|
|
||||||
"Filter for long events in function of configuration parameter 'duration_of_long_event'"
|
"Filter for long events in function of configuration parameter 'duration_of_long_event'"
|
||||||
longevents: Boolean
|
longEvents: Boolean
|
||||||
): Events
|
): Events
|
||||||
|
|
||||||
"Interact with an URI"
|
"Interact with an URI"
|
||||||
|
|
|
@ -122,7 +122,7 @@ const eventsQuery = useQuery<{
|
||||||
}>(FETCH_EVENTS, () => ({
|
}>(FETCH_EVENTS, () => ({
|
||||||
orderBy: EventSortField.BEGINS_ON,
|
orderBy: EventSortField.BEGINS_ON,
|
||||||
direction: SortDirection.ASC,
|
direction: SortDirection.ASC,
|
||||||
longevents: false,
|
longEvents: false,
|
||||||
location: geoHash.value ?? "",
|
location: geoHash.value ?? "",
|
||||||
radius: distance.value,
|
radius: distance.value,
|
||||||
limit: 93,
|
limit: 93,
|
||||||
|
|
|
@ -109,7 +109,7 @@ export const FETCH_EVENTS = gql`
|
||||||
$direction: SortDirection
|
$direction: SortDirection
|
||||||
$page: Int
|
$page: Int
|
||||||
$limit: Int
|
$limit: Int
|
||||||
$longevents: Boolean
|
$longEvents: Boolean
|
||||||
) {
|
) {
|
||||||
events(
|
events(
|
||||||
location: $location
|
location: $location
|
||||||
|
@ -118,7 +118,7 @@ export const FETCH_EVENTS = gql`
|
||||||
direction: $direction
|
direction: $direction
|
||||||
page: $page
|
page: $page
|
||||||
limit: $limit
|
limit: $limit
|
||||||
longevents: $longevents
|
longEvents: $longEvents
|
||||||
) {
|
) {
|
||||||
total
|
total
|
||||||
elements {
|
elements {
|
||||||
|
|
|
@ -33,7 +33,7 @@ export const SEARCH_EVENTS_AND_GROUPS = gql`
|
||||||
$searchTarget: SearchTarget
|
$searchTarget: SearchTarget
|
||||||
$beginsOn: DateTime
|
$beginsOn: DateTime
|
||||||
$endsOn: DateTime
|
$endsOn: DateTime
|
||||||
$longevents: Boolean
|
$longEvents: Boolean
|
||||||
$bbox: String
|
$bbox: String
|
||||||
$zoom: Int
|
$zoom: Int
|
||||||
$eventPage: Int
|
$eventPage: Int
|
||||||
|
@ -55,7 +55,7 @@ export const SEARCH_EVENTS_AND_GROUPS = gql`
|
||||||
searchTarget: $searchTarget
|
searchTarget: $searchTarget
|
||||||
beginsOn: $beginsOn
|
beginsOn: $beginsOn
|
||||||
endsOn: $endsOn
|
endsOn: $endsOn
|
||||||
longevents: $longevents
|
longEvents: $longEvents
|
||||||
bbox: $bbox
|
bbox: $bbox
|
||||||
zoom: $zoom
|
zoom: $zoom
|
||||||
page: $eventPage
|
page: $eventPage
|
||||||
|
@ -155,7 +155,7 @@ export const SEARCH_EVENTS = gql`
|
||||||
$endsOn: DateTime
|
$endsOn: DateTime
|
||||||
$eventPage: Int
|
$eventPage: Int
|
||||||
$limit: Int
|
$limit: Int
|
||||||
$longevents: Boolean
|
$longEvents: Boolean
|
||||||
) {
|
) {
|
||||||
searchEvents(
|
searchEvents(
|
||||||
location: $location
|
location: $location
|
||||||
|
@ -168,7 +168,7 @@ export const SEARCH_EVENTS = gql`
|
||||||
endsOn: $endsOn
|
endsOn: $endsOn
|
||||||
page: $eventPage
|
page: $eventPage
|
||||||
limit: $limit
|
limit: $limit
|
||||||
longevents: $longevents
|
longEvents: $longEvents
|
||||||
) {
|
) {
|
||||||
total
|
total
|
||||||
elements {
|
elements {
|
||||||
|
@ -218,7 +218,7 @@ export const SEARCH_CALENDAR_EVENTS = gql`
|
||||||
endsOn: $endsOn
|
endsOn: $endsOn
|
||||||
page: $eventPage
|
page: $eventPage
|
||||||
limit: $limit
|
limit: $limit
|
||||||
longevents: false
|
longEvents: false
|
||||||
) {
|
) {
|
||||||
total
|
total
|
||||||
elements {
|
elements {
|
||||||
|
|
|
@ -1049,7 +1049,7 @@ const { result: searchElementsResult, loading: searchLoading } = useQuery<{
|
||||||
location: geoHashLocation.value,
|
location: geoHashLocation.value,
|
||||||
beginsOn: start.value,
|
beginsOn: start.value,
|
||||||
endsOn: end.value,
|
endsOn: end.value,
|
||||||
longevents: longEvents.value,
|
longEvents: longEvents.value,
|
||||||
radius: geoHashLocation.value ? radius.value : undefined,
|
radius: geoHashLocation.value ? radius.value : undefined,
|
||||||
eventPage: eventPage.value,
|
eventPage: eventPage.value,
|
||||||
groupPage: groupPage.value,
|
groupPage: groupPage.value,
|
||||||
|
|
|
@ -18,8 +18,8 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do
|
||||||
|
|
||||||
describe "search events/3" do
|
describe "search events/3" do
|
||||||
@search_events_query """
|
@search_events_query """
|
||||||
query SearchEvents($location: String, $radius: Float, $tags: String, $term: String, $beginsOn: DateTime, $endsOn: DateTime, $longevents:Boolean, $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) {
|
searchEvents(location: $location, radius: $radius, tags: $tags, term: $term, beginsOn: $beginsOn, endsOn: $endsOn, longEvents: $longEvents, searchTarget: $searchTarget) {
|
||||||
total,
|
total,
|
||||||
elements {
|
elements {
|
||||||
id
|
id
|
||||||
|
@ -224,7 +224,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do
|
||||||
res =
|
res =
|
||||||
AbsintheHelpers.graphql_query(conn,
|
AbsintheHelpers.graphql_query(conn,
|
||||||
query: @search_events_query,
|
query: @search_events_query,
|
||||||
variables: %{longevents: false}
|
variables: %{longEvents: false}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert res["errors"] == nil
|
assert res["errors"] == nil
|
||||||
|
@ -241,7 +241,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do
|
||||||
res =
|
res =
|
||||||
AbsintheHelpers.graphql_query(conn,
|
AbsintheHelpers.graphql_query(conn,
|
||||||
query: @search_events_query,
|
query: @search_events_query,
|
||||||
variables: %{longevents: true}
|
variables: %{longEvents: true}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert res["errors"] == nil
|
assert res["errors"] == nil
|
||||||
|
@ -296,7 +296,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do
|
||||||
res =
|
res =
|
||||||
AbsintheHelpers.graphql_query(conn,
|
AbsintheHelpers.graphql_query(conn,
|
||||||
query: @search_events_query,
|
query: @search_events_query,
|
||||||
variables: %{longevents: false}
|
variables: %{longEvents: false}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert res["errors"] == nil
|
assert res["errors"] == nil
|
||||||
|
@ -311,7 +311,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do
|
||||||
res =
|
res =
|
||||||
AbsintheHelpers.graphql_query(conn,
|
AbsintheHelpers.graphql_query(conn,
|
||||||
query: @search_events_query,
|
query: @search_events_query,
|
||||||
variables: %{longevents: true}
|
variables: %{longEvents: true}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert res["errors"] == nil
|
assert res["errors"] == nil
|
||||||
|
@ -364,7 +364,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do
|
||||||
res =
|
res =
|
||||||
AbsintheHelpers.graphql_query(conn,
|
AbsintheHelpers.graphql_query(conn,
|
||||||
query: @search_events_query,
|
query: @search_events_query,
|
||||||
variables: %{longevents: false}
|
variables: %{longEvents: false}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert res["errors"] == nil
|
assert res["errors"] == nil
|
||||||
|
@ -378,7 +378,7 @@ defmodule Mobilizon.GraphQL.Resolvers.SearchTest do
|
||||||
res =
|
res =
|
||||||
AbsintheHelpers.graphql_query(conn,
|
AbsintheHelpers.graphql_query(conn,
|
||||||
query: @search_events_query,
|
query: @search_events_query,
|
||||||
variables: %{longevents: true}
|
variables: %{longEvents: true}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert res["errors"] == nil
|
assert res["errors"] == nil
|
||||||
|
|
Loading…
Reference in a new issue