Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
gab
social
gab-social
Commits
9b17b0a5
Commit
9b17b0a5
authored
Feb 18, 2021
by
rubic0n
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce array allocations by using a constant
parent
b1445d09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
app/serializers/rest/status_serializer.rb
app/serializers/rest/status_serializer.rb
+3
-2
No files found.
app/serializers/rest/status_serializer.rb
View file @
9b17b0a5
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment