Include organizer actor in icalendar export
Closes #907 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
6d9fe639d6
commit
2401abedb5
|
@ -3,6 +3,7 @@ defmodule Mobilizon.Service.Export.ICalendar do
|
||||||
Export an event to iCalendar format.
|
Export an event to iCalendar format.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
alias Mobilizon.{Config, Events}
|
alias Mobilizon.{Config, Events}
|
||||||
alias Mobilizon.Events.{Event, EventOptions}
|
alias Mobilizon.Events.{Event, EventOptions}
|
||||||
|
@ -119,7 +120,8 @@ defmodule Mobilizon.Service.Export.ICalendar do
|
||||||
dtend: ends_on(event),
|
dtend: ends_on(event),
|
||||||
description: HTML.strip_tags(event.description),
|
description: HTML.strip_tags(event.description),
|
||||||
uid: event.uuid,
|
uid: event.uuid,
|
||||||
url: event.url
|
url: event.url,
|
||||||
|
organizer: organizer(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
icalendar_event =
|
icalendar_event =
|
||||||
|
@ -161,4 +163,12 @@ defmodule Mobilizon.Service.Export.ICalendar do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp shift_tz(%DateTime{} = date, _), do: date
|
defp shift_tz(%DateTime{} = date, _), do: date
|
||||||
|
|
||||||
|
defp organizer(%Event{attributed_to: %Actor{} = group}) do
|
||||||
|
Actor.display_name(group)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp organizer(%Event{organizer_actor: %Actor{} = profile}) do
|
||||||
|
Actor.display_name(profile)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,6 +26,7 @@ defmodule Mobilizon.Service.ICalendarTest do
|
||||||
DTSTART:#{Value.to_ics(event.begins_on)}Z
|
DTSTART:#{Value.to_ics(event.begins_on)}Z
|
||||||
GEO:#{event.physical_address |> Address.coords() |> Tuple.to_list() |> Enum.join(";")}
|
GEO:#{event.physical_address |> Address.coords() |> Tuple.to_list() |> Enum.join(";")}
|
||||||
LOCATION:#{Address.representation(event.physical_address)}
|
LOCATION:#{Address.representation(event.physical_address)}
|
||||||
|
ORGANIZER:#{event.organizer_actor.name}
|
||||||
SUMMARY:#{event.title}
|
SUMMARY:#{event.title}
|
||||||
UID:#{event.uuid}
|
UID:#{event.uuid}
|
||||||
URL:#{event.url}
|
URL:#{event.url}
|
||||||
|
|
Loading…
Reference in a new issue