diff options
author | Alex Gleason <alex@alexgleason.me> | 2020-11-14 19:48:47 -0600 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2020-11-14 19:48:47 -0600 |
commit | 9546c1444c2c8c4abc9bcb35b6a8ff360ddc83af (patch) | |
tree | cc6b9add45f34878b1ce053b6a408e059768fa6a /lib/pleroma/emails/user_email.ex | |
parent | dc38dc847207e4724265fbeb111d0a236b75f93f (diff) | |
parent | 28da36975dc325bb577ee81fb791fbdc7ec3e7e2 (diff) | |
download | pleroma-9546c1444c2c8c4abc9bcb35b6a8ff360ddc83af.tar.gz |
Merge remote-tracking branch 'upstream/develop' into registration-workflow
Diffstat (limited to 'lib/pleroma/emails/user_email.ex')
-rw-r--r-- | lib/pleroma/emails/user_email.ex | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index 831e5464f..3b9275bc3 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -202,4 +202,30 @@ defmodule Pleroma.Emails.UserEmail do Router.Helpers.subscription_url(Endpoint, :unsubscribe, token) end + + def backup_is_ready_email(backup, admin_user_id \\ nil) do + %{user: user} = Pleroma.Repo.preload(backup, :user) + download_url = Pleroma.Web.PleromaAPI.BackupView.download_url(backup) + + html_body = + if is_nil(admin_user_id) do + """ + <p>You requested a full backup of your Pleroma account. It's ready for download:</p> + <p><a href="#{download_url}">#{download_url}</a></p> + """ + else + admin = Pleroma.Repo.get(User, admin_user_id) + + """ + <p>Admin @#{admin.nickname} requested a full backup of your Pleroma account. It's ready for download:</p> + <p><a href="#{download_url}">#{download_url}</a></p> + """ + end + + new() + |> to(recipient(user)) + |> from(sender()) + |> subject("Your account archive is ready") + |> html_body(html_body) + end end |