From c1b84edefcd8db998a7eabff110f2dabecfc8dde Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 8 Jun 2024 22:48:38 -0400 Subject: [PATCH] Increase web push character limit for the body --- lib/pleroma/web/push/impl.ex | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex index 98e7659ab..13c054e05 100644 --- a/lib/pleroma/web/push/impl.ex +++ b/lib/pleroma/web/push/impl.ex @@ -16,6 +16,7 @@ defmodule Pleroma.Web.Push.Impl do require Logger import Ecto.Query + @body_chars 140 @types ["Create", "Follow", "Announce", "Like", "Move", "EmojiReact", "Update"] @doc "Performs sending notifications for user subscriptions" @@ -126,7 +127,7 @@ defmodule Pleroma.Web.Push.Impl do def format_body(_notification, user, %{data: %{"type" => "ChatMessage"} = object}) do case object["content"] do nil -> "@#{user.nickname}: (Attachment)" - content -> "@#{user.nickname}: #{Utils.scrub_html_and_truncate(content, 80)}" + content -> "@#{user.nickname}: #{Utils.scrub_html_and_truncate(content, @body_chars)}" end end @@ -145,7 +146,7 @@ defmodule Pleroma.Web.Push.Impl do [content_text, options_text] |> Enum.join("\n") - |> Utils.scrub_html_and_truncate(80) + |> Utils.scrub_html_and_truncate(@body_chars) end def format_body( @@ -153,7 +154,7 @@ defmodule Pleroma.Web.Push.Impl do user, %{data: %{"content" => content}} ) do - "@#{user.nickname}: #{Utils.scrub_html_and_truncate(content, 80)}" + "@#{user.nickname}: #{Utils.scrub_html_and_truncate(content, @body_chars)}" end def format_body( @@ -161,7 +162,7 @@ defmodule Pleroma.Web.Push.Impl do user, %{data: %{"content" => content}} ) do - "@#{user.nickname} repeated: #{Utils.scrub_html_and_truncate(content, 80)}" + "@#{user.nickname} repeated: #{Utils.scrub_html_and_truncate(content, @body_chars)}" end def format_body(