WebPush: Don't break on contentless chat messages.
This commit is contained in:
parent
f24d2f714f
commit
4e8c0eecd5
2 changed files with 32 additions and 0 deletions
|
|
@ -124,6 +124,13 @@ defmodule Pleroma.Web.Push.Impl do
|
|||
|
||||
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
|
||||
|
||||
def format_body(
|
||||
%{activity: %{data: %{"type" => "Create"}}},
|
||||
actor,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue