diff --git a/lib/service/export/icalendar.ex b/lib/service/export/icalendar.ex index 9a75c308a..a514648d9 100644 --- a/lib/service/export/icalendar.ex +++ b/lib/service/export/icalendar.ex @@ -3,6 +3,7 @@ defmodule Mobilizon.Service.Export.ICalendar do Export an event to iCalendar format. """ + alias Mobilizon.Actors.Actor alias Mobilizon.Addresses.Address alias Mobilizon.{Config, Events} alias Mobilizon.Events.{Event, EventOptions} @@ -119,7 +120,8 @@ defmodule Mobilizon.Service.Export.ICalendar do dtend: ends_on(event), description: HTML.strip_tags(event.description), uid: event.uuid, - url: event.url + url: event.url, + organizer: organizer(event) } icalendar_event = @@ -161,4 +163,12 @@ defmodule Mobilizon.Service.Export.ICalendar do end 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 diff --git a/lib/web/templates/email/email.html.heex b/lib/web/templates/email/email.html.heex index 6f4802614..789baa6f5 100644 --- a/lib/web/templates/email/email.html.heex +++ b/lib/web/templates/email/email.html.heex @@ -141,12 +141,14 @@ <!-- ADDRESS --> <tr> <td bgcolor="#ECEBF2" align="center" style="padding: 30px 30px 30px 30px; color: #474467; font-family: 'Roboto', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;" > - <p style="margin: 0;"> - <%= if @offer_unsupscription do %> + <%= if @offer_unsupscription do %> + <p> <a href={"#{Mobilizon.Web.Endpoint.url()}/settings/notifications"}> <%= gettext("Manage your notification settings") %> </a> - <% end %> + </p> + <% end %> + <p style="margin: 0;"> <%= gettext("<b>%{instance}</b> is powered by Mobilizon.", instance: @instance_name) |> raw %><br /> <a href="https://joinmobilizon.org"><%= gettext "Learn more about Mobilizon here!" %></a> </p> diff --git a/test/service/export/icalendar_test.exs b/test/service/export/icalendar_test.exs index c849e7f10..0cdadc93b 100644 --- a/test/service/export/icalendar_test.exs +++ b/test/service/export/icalendar_test.exs @@ -26,6 +26,7 @@ defmodule Mobilizon.Service.ICalendarTest do DTSTART:#{Value.to_ics(event.begins_on)}Z GEO:#{event.physical_address |> Address.coords() |> Tuple.to_list() |> Enum.join(";")} LOCATION:#{Address.representation(event.physical_address)} + ORGANIZER:#{event.organizer_actor.name} SUMMARY:#{event.title} UID:#{event.uuid} URL:#{event.url}