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

pull/2105/head
Jeong Arm 2023-02-07 09:03:26 +09:00 committed by GitHub
parent bb89f0af8a
commit 523a86618f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

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