2020-01-22 16:31:42 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-13 06:49:20 +00:00
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2020-01-22 16:31:42 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Emails.NewUsersDigestEmail do
|
|
|
|
use Phoenix.Swoosh, view: Pleroma.Web.EmailView, layout: {Pleroma.Web.LayoutView, :email_styled}
|
|
|
|
|
|
|
|
defp instance_notify_email do
|
|
|
|
Pleroma.Config.get([:instance, :notify_email]) || Pleroma.Config.get([:instance, :email])
|
|
|
|
end
|
|
|
|
|
|
|
|
def new_users(to, users_and_statuses) do
|
|
|
|
instance_name = Pleroma.Config.get([:instance, :name])
|
|
|
|
styling = Pleroma.Config.get([Pleroma.Emails.UserEmail, :styling])
|
|
|
|
|
2020-02-11 19:33:05 +00:00
|
|
|
logo_url =
|
2020-04-12 19:54:43 +00:00
|
|
|
Pleroma.Helpers.UriHelper.maybe_add_base(
|
|
|
|
Pleroma.Config.get([:frontend_configurations, :pleroma_fe, :logo]),
|
|
|
|
Pleroma.Web.Endpoint.url()
|
|
|
|
)
|
2020-01-22 16:31:42 +00:00
|
|
|
|
|
|
|
new()
|
|
|
|
|> to({to.name, to.email})
|
|
|
|
|> from({instance_name, instance_notify_email()})
|
|
|
|
|> subject("#{instance_name} New Users")
|
|
|
|
|> render_body("new_users_digest.html", %{
|
|
|
|
title: "New Users",
|
|
|
|
users_and_statuses: users_and_statuses,
|
|
|
|
instance: instance_name,
|
2020-02-11 19:33:05 +00:00
|
|
|
styling: styling,
|
|
|
|
logo_url: logo_url
|
2020-01-22 16:31:42 +00:00
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|