diff options
author | lain <lain@soykaf.club> | 2020-06-06 09:46:07 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-06-06 09:46:07 +0200 |
commit | 4e8c0eecd5179428a47795380a9da1ab0419e024 (patch) | |
tree | 6949f16ca83e498e5f0c322ca03c5d110e2b10ef /lib | |
parent | f24d2f714f44175cae9fcd878de1629ee32be73c (diff) | |
download | pleroma-4e8c0eecd5179428a47795380a9da1ab0419e024.tar.gz |
WebPush: Don't break on contentless chat messages.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/push/impl.ex | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex index 006a242af..cdb827e76 100644 --- a/lib/pleroma/web/push/impl.ex +++ b/lib/pleroma/web/push/impl.ex @@ -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, |