mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 19:29:11 +00:00
Merge branch 'admin-report-view-user-fallback' into 'develop'
Handle deleted reported accounts in report admin API Closes #1046 See merge request pleroma/pleroma!1370
This commit is contained in:
commit
a565dbde4f
2 changed files with 19 additions and 1 deletions
|
@ -46,8 +46,10 @@ defmodule Pleroma.Web.AdminAPI.ReportView do
|
|||
}
|
||||
end
|
||||
|
||||
defp merge_account_views(user) do
|
||||
defp merge_account_views(%User{} = user) do
|
||||
Pleroma.Web.MastodonAPI.AccountView.render("account.json", %{user: user})
|
||||
|> Map.merge(Pleroma.Web.AdminAPI.AccountView.render("show.json", %{user: user}))
|
||||
end
|
||||
|
||||
defp merge_account_views(_), do: %{}
|
||||
end
|
||||
|
|
|
@ -111,4 +111,20 @@ defmodule Pleroma.Web.AdminAPI.ReportViewTest do
|
|||
refute "<script> alert('hecked :D:D:D:D:D:D:D') </script>" ==
|
||||
ReportView.render("show.json", %{report: activity})[:content]
|
||||
end
|
||||
|
||||
test "doesn't error out when the user doesn't exists" do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, activity} =
|
||||
CommonAPI.report(user, %{
|
||||
"account_id" => other_user.id,
|
||||
"comment" => ""
|
||||
})
|
||||
|
||||
Pleroma.User.delete(other_user)
|
||||
Pleroma.User.invalidate_cache(other_user)
|
||||
|
||||
assert %{} = ReportView.render("show.json", %{report: activity})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue