mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-01-03 05:48:42 +00:00
Increase web push character limit for the body
This commit is contained in:
parent
dcc50da400
commit
c1b84edefc
1 changed files with 5 additions and 4 deletions
|
@ -16,6 +16,7 @@ defmodule Pleroma.Web.Push.Impl do
|
||||||
require Logger
|
require Logger
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
|
||||||
|
@body_chars 140
|
||||||
@types ["Create", "Follow", "Announce", "Like", "Move", "EmojiReact", "Update"]
|
@types ["Create", "Follow", "Announce", "Like", "Move", "EmojiReact", "Update"]
|
||||||
|
|
||||||
@doc "Performs sending notifications for user subscriptions"
|
@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
|
def format_body(_notification, user, %{data: %{"type" => "ChatMessage"} = object}) do
|
||||||
case object["content"] do
|
case object["content"] do
|
||||||
nil -> "@#{user.nickname}: (Attachment)"
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ defmodule Pleroma.Web.Push.Impl do
|
||||||
|
|
||||||
[content_text, options_text]
|
[content_text, options_text]
|
||||||
|> Enum.join("\n")
|
|> Enum.join("\n")
|
||||||
|> Utils.scrub_html_and_truncate(80)
|
|> Utils.scrub_html_and_truncate(@body_chars)
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_body(
|
def format_body(
|
||||||
|
@ -153,7 +154,7 @@ defmodule Pleroma.Web.Push.Impl do
|
||||||
user,
|
user,
|
||||||
%{data: %{"content" => content}}
|
%{data: %{"content" => content}}
|
||||||
) do
|
) do
|
||||||
"@#{user.nickname}: #{Utils.scrub_html_and_truncate(content, 80)}"
|
"@#{user.nickname}: #{Utils.scrub_html_and_truncate(content, @body_chars)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_body(
|
def format_body(
|
||||||
|
@ -161,7 +162,7 @@ defmodule Pleroma.Web.Push.Impl do
|
||||||
user,
|
user,
|
||||||
%{data: %{"content" => content}}
|
%{data: %{"content" => content}}
|
||||||
) do
|
) do
|
||||||
"@#{user.nickname} repeated: #{Utils.scrub_html_and_truncate(content, 80)}"
|
"@#{user.nickname} repeated: #{Utils.scrub_html_and_truncate(content, @body_chars)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_body(
|
def format_body(
|
||||||
|
|
Loading…
Reference in a new issue