mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-13 12:31:13 +00:00
Ensure the webpush notification for e.g., mentions start with the nickname of the actor it originates from
This commit is contained in:
parent
603a575766
commit
a291a6b8c0
2 changed files with 19 additions and 0 deletions
0
changelog.d/web_push_actor_regression.skip
Normal file
0
changelog.d/web_push_actor_regression.skip
Normal file
|
@ -417,4 +417,23 @@ defmodule Pleroma.Web.Push.ImplTest do
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
test "build/1 notification payload body starts with nickname of actor the notification originated from" do
|
||||
user = insert(:user, nickname: "Bob")
|
||||
user2 = insert(:user, nickname: "Tom")
|
||||
insert(:push_subscription, user: user2, data: %{alerts: %{"mention" => true}})
|
||||
|
||||
{:ok, activity} =
|
||||
CommonAPI.post(user, %{
|
||||
status: "@Tom Hey are you okay?"
|
||||
})
|
||||
|
||||
{:ok, [notification]} = Notification.create_notifications(activity)
|
||||
|
||||
[push] = Impl.build(notification)
|
||||
|
||||
{:ok, payload} = Jason.decode(push.payload)
|
||||
|
||||
assert String.starts_with?(payload["body"], "@Bob:")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue