summaryrefslogtreecommitdiff
path: root/test/web/push/impl_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/web/push/impl_test.exs')
-rw-r--r--test/web/push/impl_test.exs25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/web/push/impl_test.exs b/test/web/push/impl_test.exs
index 8fb7faaa5..b48952b29 100644
--- a/test/web/push/impl_test.exs
+++ b/test/web/push/impl_test.exs
@@ -8,6 +8,7 @@ defmodule Pleroma.Web.Push.ImplTest do
alias Pleroma.Notification
alias Pleroma.Object
alias Pleroma.User
+ alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.Push.Impl
alias Pleroma.Web.Push.Subscription
@@ -213,6 +214,30 @@ defmodule Pleroma.Web.Push.ImplTest do
}
end
+ test "builds content for chat messages with no content" do
+ user = insert(:user)
+ recipient = insert(:user)
+
+ file = %Plug.Upload{
+ content_type: "image/jpg",
+ path: Path.absname("test/fixtures/image.jpg"),
+ filename: "an_image.jpg"
+ }
+
+ {:ok, upload} = ActivityPub.upload(file, actor: user.ap_id)
+
+ {:ok, chat} = CommonAPI.post_chat_message(user, recipient, nil, media_id: upload.id)
+ object = Object.normalize(chat, false)
+ [notification] = Notification.for_user(recipient)
+
+ res = Impl.build_content(notification, user, object)
+
+ assert res == %{
+ body: "@#{user.nickname}: (Attachment)",
+ title: "New Chat Message"
+ }
+ end
+
test "hides details for notifications when privacy option enabled" do
user = insert(:user, nickname: "Bob")
user2 = insert(:user, nickname: "Rob", notification_settings: %{privacy_option: true})