fix(notifications): handle unknown users when filtering tagged mentions

The access check from the previous commit crashed on tags of unknown
users in followers-only posts, so such posts failed to be received.
Also add tests for the check.
This commit is contained in:
Lain Soykaf 2026-10-27 12:31:18 +04:00
commit cccbb39309
No known key found for this signature in database
3 changed files with 104 additions and 3 deletions

View file

@ -465,7 +465,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
true ->
author = User.get_cached_by_ap_id(actor)
to_followers = author.follower_address in recipients
to_followers = match?(%User{}, author) and author.follower_address in recipients
Enum.filter(tagged_mentions, fn tagged ->
cond do
@ -473,8 +473,10 @@ defmodule Pleroma.Web.CommonAPI.Utils do
true
to_followers ->
tagged_user = User.get_cached_by_ap_id(tagged)
User.following?(tagged_user, author)
case User.get_cached_by_ap_id(tagged) do
%User{} = tagged_user -> User.following?(tagged_user, author)
_ -> false
end
true ->
false