Merge branch 'fix-member-notification-language' into 'master'

Send the membership emails in the correct language

Closes #472

See merge request framasoft/mobilizon!735
This commit is contained in:
Thomas Citharel 2020-12-01 12:29:20 +01:00
commit 2a9e95bf7f
3 changed files with 5 additions and 4 deletions

View file

@ -526,7 +526,8 @@ defmodule Mobilizon.Federation.ActivityPub do
local local
), ),
:ok <- maybe_federate(activity), :ok <- maybe_federate(activity),
:ok <- maybe_relay_if_group_activity(activity) do :ok <- maybe_relay_if_group_activity(activity),
:ok <- Group.send_invite_to_user(member) do
{:ok, activity, member} {:ok, activity, member}
end end
end end

View file

@ -674,8 +674,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
{:ok, %Actor{} = target} <- {:ok, %Actor{} = target} <-
target |> Utils.get_url() |> ActivityPub.get_or_fetch_actor_by_url(), target |> Utils.get_url() |> ActivityPub.get_or_fetch_actor_by_url(),
{:ok, activity, %Member{} = member} <- {:ok, activity, %Member{} = member} <-
ActivityPub.invite(object, actor, target, false, %{url: id}), ActivityPub.invite(object, actor, target, false, %{url: id}) do
:ok <- Group.send_invite_to_user(member) do
{:ok, activity, member} {:ok, activity, member}
end end
end end

View file

@ -24,7 +24,8 @@ defmodule Mobilizon.Web.Email.Group do
member, member,
locale locale
) do ) do
with %User{email: email} <- Users.get_user!(user_id) do with %User{email: email} = user <- Users.get_user!(user_id) do
locale = Map.get(user, :locale, locale)
Gettext.put_locale(locale) Gettext.put_locale(locale)
%Actor{name: invited_by_name} = inviter = Actors.get_actor(member.invited_by_id) %Actor{name: invited_by_name} = inviter = Actors.get_actor(member.invited_by_id)