From 0dff18a7f0147fccb039cc6a918d4036f3c050a7 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Fri, 14 Aug 2020 17:06:53 -0500 Subject: [API] Sort associated tags by name --- app/serializers/rest/status_serializer.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app') 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 -- cgit