@@ -210,6 +210,7 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Actors do
|
||||
if actor_type == :Application do
|
||||
Instances.refresh()
|
||||
end
|
||||
|
||||
FollowMailer.send_notification_to_admins(follower)
|
||||
follower_as_data = Convertible.model_to_as(follower)
|
||||
approve_if_manually_approves_followers(follower, follower_as_data)
|
||||
|
||||
@@ -467,7 +467,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
|
||||
end
|
||||
|
||||
@spec get_instance(any, map(), Absinthe.Resolution.t()) ::
|
||||
{:error, :unauthenticated | :unauthorized | :not_found} | {:ok, Mobilizon.Instances.Instance.t()}
|
||||
{:error, :unauthenticated | :unauthorized | :not_found}
|
||||
| {:ok, Mobilizon.Instances.Instance.t()}
|
||||
def get_instance(_parent, %{domain: domain}, %{
|
||||
context: %{current_user: %User{role: role}}
|
||||
})
|
||||
|
||||
@@ -24,7 +24,10 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do
|
||||
field(:tags, list_of(:tag), description: "The event's tags")
|
||||
field(:category, :event_category, description: "The event's category")
|
||||
field(:options, :event_options, description: "The event options")
|
||||
field(:participant_stats, :participant_stats, description: "Statistics on the event's participants")
|
||||
|
||||
field(:participant_stats, :participant_stats,
|
||||
description: "Statistics on the event's participants"
|
||||
)
|
||||
|
||||
resolve_type(fn
|
||||
%Event{}, _ ->
|
||||
@@ -55,7 +58,10 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do
|
||||
field(:tags, list_of(:tag), description: "The event's tags")
|
||||
field(:category, :event_category, description: "The event's category")
|
||||
field(:options, :event_options, description: "The event options")
|
||||
field(:participant_stats, :participant_stats, description: "Statistics on the event's participants")
|
||||
|
||||
field(:participant_stats, :participant_stats,
|
||||
description: "Statistics on the event's participants"
|
||||
)
|
||||
end
|
||||
|
||||
interface :group_search_result do
|
||||
@@ -198,7 +204,10 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do
|
||||
arg(:language_one_of, list_of(:string),
|
||||
description: "The list of languages this event can be in"
|
||||
)
|
||||
arg(:boost_languages, list_of(:string), description: "The user's languages that can benefit from a boost in search results")
|
||||
|
||||
arg(:boost_languages, list_of(:string),
|
||||
description: "The user's languages that can benefit from a boost in search results"
|
||||
)
|
||||
|
||||
arg(:search_target, :search_target,
|
||||
default_value: :internal,
|
||||
@@ -238,7 +247,10 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do
|
||||
arg(:language_one_of, list_of(:string),
|
||||
description: "The list of languages this event can be in"
|
||||
)
|
||||
arg(:boost_languages, list_of(:string), description: "The user's languages that can benefit from a boost in search results")
|
||||
|
||||
arg(:boost_languages, list_of(:string),
|
||||
description: "The user's languages that can benefit from a boost in search results"
|
||||
)
|
||||
|
||||
arg(:search_target, :search_target,
|
||||
default_value: :internal,
|
||||
|
||||
@@ -541,7 +541,7 @@ defmodule Mobilizon.Events do
|
||||
|> filter_draft()
|
||||
|> filter_local_or_from_followed_instances_events()
|
||||
|> filter_public_visibility()
|
||||
|> event_order(args.sort_by)
|
||||
|> event_order(Map.get(args, :sort_by, :match_desc))
|
||||
|> Page.build_page(page, limit, :begins_on)
|
||||
end
|
||||
|
||||
@@ -1819,11 +1819,16 @@ defmodule Mobilizon.Events do
|
||||
|> event_order_begins_on_asc()
|
||||
end
|
||||
|
||||
defp event_order(query, :match_desc), do: order_by(query, [e, f], desc: f.rank, asc: e.begins_on)
|
||||
defp event_order(query, :match_desc),
|
||||
do: order_by(query, [e, f], desc: f.rank, asc: e.begins_on)
|
||||
|
||||
defp event_order(query, :start_time_desc), do: order_by(query, [e], asc: e.begins_on)
|
||||
defp event_order(query, :created_at_desc), do: order_by(query, [e], desc: e.publish_at)
|
||||
defp event_order(query, :created_at_asc), do: order_by(query, [e], asc: e.publish_at)
|
||||
defp event_order(query, :participant_count_desc), do: order_by(query, [e], fragment("participant_stats->>'participant' DESC"))
|
||||
|
||||
defp event_order(query, :participant_count_desc),
|
||||
do: order_by(query, [e], fragment("participant_stats->>'participant' DESC"))
|
||||
|
||||
defp event_order(query, _), do: query
|
||||
|
||||
defp event_order_begins_on_asc(query),
|
||||
|
||||
Reference in New Issue
Block a user