Skip to content
Snippets Groups Projects
Commit 7bb36189 authored by rinpatch's avatar rinpatch
Browse files

Merge branch 'fix-notification-filtering' into 'develop'

Notifications: Never return `nil` in the notification list.

See merge request pleroma/pleroma!2705
parents b2b33298 09c5991f
No related branches found
No related tags found
No related merge requests found
......@@ -367,6 +367,7 @@ defp do_create_notifications(%Activity{} = activity, options) do
do_send = do_send && user in enabled_receivers
create_notification(activity, user, do_send)
end)
|> Enum.reject(&is_nil/1)
{:ok, notifications}
end
......
......@@ -22,6 +22,16 @@ defmodule Pleroma.NotificationTest do
alias Pleroma.Web.Streamer
describe "create_notifications" do
test "never returns nil" do
user = insert(:user)
other_user = insert(:user, %{invisible: true})
{:ok, activity} = CommonAPI.post(user, %{status: "yeah"})
{:ok, activity} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
refute {:ok, [nil]} == Notification.create_notifications(activity)
end
test "creates a notification for an emoji reaction" do
user = insert(:user)
other_user = insert(:user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment