Fix account serializer crash if account doesn't have a user (#23428)
parent
2b356a3de6
commit
2c06ca5615
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue