summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeong Arm <kjwonmail@gmail.com>2023-02-07 09:03:26 +0900
committerGitHub <noreply@github.com>2023-02-07 01:03:26 +0100
commit523a86618f8a1825e620a2461e465db3b4e1dc57 (patch)
tree4fb99f8c47b27113fe2b29987e7b16553d5c7210
parentbb89f0af8a54abe4ae790f11b6f7c03a00158cfc (diff)
Fix account serializer crash if account doesn't have a user (#23428)
-rw-r--r--app/serializers/rest/account_serializer.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index 62eac1fbdef..f6fad9fe145 100644
--- a/app/serializers/rest/account_serializer.rb
+++ b/app/serializers/rest/account_serializer.rb
@@ -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