Fix admin notification e-mails from instance follow for Mastodon

instances

Show an appropriate name in the body of the mail

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-05-06 16:36:04 +02:00
parent f58d6829da
commit 0b49021f8b
5 changed files with 117 additions and 25 deletions

View File

@@ -44,11 +44,19 @@ defmodule Mobilizon.Web.Email.Follow do
subject =
if follower_type == :Application do
gettext(
"Instance %{name} (%{domain}) requests to follow your instance",
name: follower.name,
domain: follower.domain
)
# Mastodon instance actor has no name and an username equal to the domain
if is_nil(follower.name) and follower.preferred_username == follower.domain do
gettext(
"Instance %{domain} requests to follow your instance",
domain: follower.domain
)
else
gettext(
"Instance %{name} (%{domain}) requests to follow your instance",
name: follower.name || follower.preferred_username,
domain: follower.domain
)
end
else
gettext(
"%{name} requests to follow your instance",