mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Merge branch 'bugfix/notification-nil-actor' into 'develop'
notification_view.ex: Make sure `account` isn’t empty See merge request pleroma/pleroma!1779
This commit is contained in:
commit
01da6344b9
2 changed files with 38 additions and 28 deletions
|
@ -25,11 +25,12 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do
|
|||
parent_activity = Activity.get_create_by_object_ap_id(activity.data["object"])
|
||||
mastodon_type = Activity.mastodon_notification_type(activity)
|
||||
|
||||
with %{id: _} = account <- AccountView.render("show.json", %{user: actor, for: user}) do
|
||||
response = %{
|
||||
id: to_string(notification.id),
|
||||
type: mastodon_type,
|
||||
created_at: CommonAPI.Utils.to_masto_date(notification.inserted_at),
|
||||
account: AccountView.render("show.json", %{user: actor, for: user}),
|
||||
account: account,
|
||||
pleroma: %{
|
||||
is_seen: notification.seen
|
||||
}
|
||||
|
@ -60,5 +61,8 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do
|
|||
_ ->
|
||||
nil
|
||||
end
|
||||
else
|
||||
_ -> nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -100,5 +100,11 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
|
|||
NotificationView.render("index.json", %{notifications: [notification], for: followed})
|
||||
|
||||
assert [expected] == result
|
||||
|
||||
User.perform(:delete, follower)
|
||||
notification = Notification |> Repo.one() |> Repo.preload(:activity)
|
||||
|
||||
assert [] ==
|
||||
NotificationView.render("index.json", %{notifications: [notification], for: followed})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue