1
0
Fork 1
forked from fedi/mastodon

Fix account serializer crash if account doesn't have a user (#23428)

This commit is contained in:
Jeong Arm 2023-02-07 09:03:26 +09:00 committed by talon
parent ac60c9f29a
commit 9b6179665f

View file

@ -125,10 +125,10 @@ class REST::AccountSerializer < ActiveModel::Serializer
end
def roles
if object.suspended?
if object.suspended? || object.user.nil?
[]
else
[object.user.role].compact.filter { |role| role.highlighted? }
[object.user.role].compact.filter(&:highlighted?)
end
end