+ def build_content(notification, actor, object, mastodon_type \\ nil)
+
+ def build_content(
+ %{
+ user: %{notification_settings: %{privacy_option: true}}
+ } = notification,
+ _actor,
+ _object,
+ mastodon_type
+ ) do
+ %{body: format_title(notification, mastodon_type)}
+ end
+
+ def build_content(notification, actor, object, mastodon_type) do
+ mastodon_type = mastodon_type || notification.type
+
+ %{
+ title: format_title(notification, mastodon_type),
+ body: format_body(notification, actor, object, mastodon_type)
+ }
+ end
+
+ def format_body(activity, actor, object, mastodon_type \\ nil)
+
+ def format_body(_activity, actor, %{data: %{"type" => "ChatMessage", "content" => content}}, _) do
+ case content do
+ nil -> "@#{actor.nickname}: (Attachment)"
+ content -> "@#{actor.nickname}: #{Utils.scrub_html_and_truncate(content, 80)}"
+ end
+ end
+