about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-08-14 17:06:53 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:18 -0500
commit0dff18a7f0147fccb039cc6a918d4036f3c050a7 (patch)
treee26be14aaa97efaa74a68ab070d39eaef214128a /app
parentf108ff87f30477f97a05a50b2e82a07243b19cda (diff)
[API] Sort associated tags by name
Diffstat (limited to 'app')
-rw-r--r--app/serializers/rest/status_serializer.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index 8578775c4..081b42979 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -31,7 +31,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
 
   has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
   has_many :ordered_mentions, key: :mentions
-  has_many :tags
+  has_many :ordered_tags, key: :tags
   has_many :emojis, serializer: REST::CustomEmojiSerializer
 
   has_one :preview_card, key: :card, serializer: REST::PreviewCardSerializer
@@ -165,6 +165,10 @@ class REST::StatusSerializer < ActiveModel::Serializer
     object.active_mentions.to_a.sort_by(&:id)
   end
 
+  def ordered_tags
+    object.tags.order('name')
+  end
+
   class ApplicationSerializer < ActiveModel::Serializer
     attributes :name, :website
   end