From 9b17b0a553ed945ff1ccfadd08c7661645f9ae6b Mon Sep 17 00:00:00 2001 From: rubic0n Date: Thu, 18 Feb 2021 00:54:29 -0600 Subject: [PATCH] Reduce array allocations by using a constant --- app/serializers/rest/status_serializer.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 184c6c35..d01d0cfe 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -8,7 +8,7 @@ class REST::StatusSerializer < ActiveModel::Serializer attribute :favourited, if: :current_user? attribute :reblogged, if: :current_user? - + attribute :content, unless: :source_requested? attribute :rich_content, unless: :source_requested? attribute :plain_markdown, unless: :source_requested? @@ -110,11 +110,12 @@ class REST::StatusSerializer < ActiveModel::Serializer return end + PINNABLE_VISIBILITIES = %w(public unlisted).freeze def pinnable current_user? && current_user.account_id == object.account_id && !object.reblog? && - %w(public unlisted).include?(object.visibility) + PINNABLE_VISIBILITIES.include?(object.visibility) end def pinned_by_group