Add timeline events you're going to
Mix format Fix chocobozzz feedback Only show upcoming events on feed Remove console log calls Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -6,6 +6,7 @@ defmodule MobilizonWeb.Resolvers.Person do
|
||||
alias Mobilizon.Actors.Actor
|
||||
alias Mobilizon.Users.User
|
||||
alias Mobilizon.Users
|
||||
alias Mobilizon.Events
|
||||
alias Mobilizon.Service.ActivityPub
|
||||
|
||||
@doc """
|
||||
@@ -83,4 +84,34 @@ defmodule MobilizonWeb.Resolvers.Person do
|
||||
{:error, e}
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the list of events this person is going to
|
||||
"""
|
||||
def person_going_to_events(%Actor{id: actor_id}, _args, %{
|
||||
context: %{current_user: user}
|
||||
}) do
|
||||
with {:is_owned, true, actor} <- User.owns_actor(user, actor_id),
|
||||
events <- Events.list_event_participations_for_actor(actor) do
|
||||
{:ok, events}
|
||||
else
|
||||
{:is_owned, false} ->
|
||||
{:error, "Actor id is not owned by authenticated user"}
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the list of events this person is going to
|
||||
"""
|
||||
def person_going_to_events(_parent, %{}, %{
|
||||
context: %{current_user: user}
|
||||
}) do
|
||||
with %Actor{} = actor <- Users.get_actor_for_user(user),
|
||||
events <- Events.list_event_participations_for_actor(actor) do
|
||||
{:ok, events}
|
||||
else
|
||||
{:is_owned, false} ->
|
||||
{:error, "Actor id is not owned by authenticated user"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,6 +53,11 @@ defmodule MobilizonWeb.Schema.Actors.PersonType do
|
||||
resolve: dataloader(Events),
|
||||
description: "A list of the events this actor has organized"
|
||||
)
|
||||
|
||||
@desc "The list of events this person goes to"
|
||||
field :going_to_events, list_of(:event) do
|
||||
resolve(&Resolvers.Person.person_going_to_events/3)
|
||||
end
|
||||
end
|
||||
|
||||
object :person_queries do
|
||||
|
||||
@@ -88,7 +88,9 @@ defmodule Mobilizon.Service.Export.Feed do
|
||||
# Create an entry for the Atom feed
|
||||
@spec get_entry(Event.t()) :: any()
|
||||
defp get_entry(%Event{} = event) do
|
||||
with {:ok, html, []} <- Earmark.as_html(event.description) do
|
||||
description = event.description || ""
|
||||
|
||||
with {:ok, html, []} <- Earmark.as_html(description) do
|
||||
entry =
|
||||
Entry.new(event.url, event.publish_at || event.inserted_at, event.title)
|
||||
|> Entry.link(event.url, rel: "alternate", type: "text/html")
|
||||
|
||||
Reference in New Issue
Block a user