Commit 9b17b0a5 authored by rubic0n's avatar rubic0n

Reduce array allocations by using a constant

parent b1445d09
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment