aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma')
-rw-r--r--lib/pleroma/digest_email_worker.ex4
-rw-r--r--lib/pleroma/emails/user_email.ex20
-rw-r--r--lib/pleroma/web/templates/email/digest.html.eex4
3 files changed, 20 insertions, 8 deletions
diff --git a/lib/pleroma/digest_email_worker.ex b/lib/pleroma/digest_email_worker.ex
index f7b3d81cd..8c28dca18 100644
--- a/lib/pleroma/digest_email_worker.ex
+++ b/lib/pleroma/digest_email_worker.ex
@@ -18,9 +18,9 @@ defmodule Pleroma.DigestEmailWorker do
|> run()
end
- defp run([]), do: :ok
+ def run([]), do: :ok
- defp run([user | users]) do
+ def run([user | users]) do
with %Swoosh.Email{} = email <- Pleroma.Emails.UserEmail.digest_email(user) do
Pleroma.Emails.Mailer.deliver_async(email)
end
diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex
index 64f855112..0ad0aed40 100644
--- a/lib/pleroma/emails/user_email.ex
+++ b/lib/pleroma/emails/user_email.ex
@@ -103,12 +103,24 @@ defmodule Pleroma.Emails.UserEmail do
new_notifications =
Pleroma.Notification.for_user_since(user, user.last_digest_emailed_at)
|> Enum.reduce(%{followers: [], mentions: []}, fn
- %{activity: %{data: %{"type" => "Create"}, actor: actor}} = notification, acc ->
- new_mention = %{data: notification, from: Pleroma.User.get_by_ap_id(actor)}
+ %{activity: %{data: %{"type" => "Create"}, actor: actor} = activity} = notification,
+ acc ->
+ new_mention = %{
+ data: notification,
+ object: Pleroma.Object.normalize(activity),
+ from: Pleroma.User.get_by_ap_id(actor)
+ }
+
%{acc | mentions: [new_mention | acc.mentions]}
- %{activity: %{data: %{"type" => "Follow"}, actor: actor}} = notification, acc ->
- new_follower = %{data: notification, from: Pleroma.User.get_by_ap_id(actor)}
+ %{activity: %{data: %{"type" => "Follow"}, actor: actor} = activity} = notification,
+ acc ->
+ new_follower = %{
+ data: notification,
+ object: Pleroma.Object.normalize(activity),
+ from: Pleroma.User.get_by_ap_id(actor)
+ }
+
%{acc | followers: [new_follower | acc.followers]}
_, acc ->
diff --git a/lib/pleroma/web/templates/email/digest.html.eex b/lib/pleroma/web/templates/email/digest.html.eex
index 93c9c884f..c9dd699fd 100644
--- a/lib/pleroma/web/templates/email/digest.html.eex
+++ b/lib/pleroma/web/templates/email/digest.html.eex
@@ -2,8 +2,8 @@
<h2>New Mentions:</h2>
<ul>
-<%= for %{data: mention, from: from} <- @mentions do %>
- <li><%= link from.nickname, to: mention.activity.actor %>: <%= raw mention.activity.object.data["content"] %></li>
+<%= for %{data: mention, object: object, from: from} <- @mentions do %>
+ <li><%= link from.nickname, to: mention.activity.actor %>: <%= raw object.data["content"] %></li>
<% end %>
</ul>