Make notifs view work for reports

* These are the first small steps for issue 2034 "Reports should send a notification to admins".
* I added a new type of notification "pleroma:report" to the the database manually (a migration will need to be written later)
* I added the new type to the notification_controller
* I made the view return the notification. It doesn't include the report itself (yet)
This commit is contained in:
Ilja 2020-11-13 13:35:46 +00:00 committed by lain
commit 70e4b86250
9 changed files with 155 additions and 3 deletions

View file

@ -32,6 +32,19 @@ defmodule Pleroma.NotificationTest do
refute {:ok, [nil]} == Notification.create_notifications(activity)
end
test "creates a notification for a report" do
reporting_user = insert(:user)
reported_user = insert(:user)
{:ok, moderator_user} = insert(:user) |> User.admin_api_update(%{is_moderator: true})
{:ok, activity} = CommonAPI.report(reporting_user, %{account_id: reported_user.id})
{:ok, [notification]} = Notification.create_notifications(activity)
assert notification.user_id == moderator_user.id
assert notification.type == "pleroma:report"
end
test "creates a notification for an emoji reaction" do
user = insert(:user)
other_user = insert(:user)