Merge branch 'main' into glitch-soc/merge-upstream
This commit is contained in:
@@ -3,4 +3,9 @@
|
||||
class REST::FilterResultSerializer < ActiveModel::Serializer
|
||||
belongs_to :filter, serializer: REST::FilterSerializer
|
||||
has_many :keyword_matches
|
||||
has_many :status_matches
|
||||
|
||||
def status_matches
|
||||
object.status_matches&.map(&:to_s)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class REST::FilterSerializer < ActiveModel::Serializer
|
||||
attributes :id, :title, :context, :expires_at, :filter_action
|
||||
has_many :keywords, serializer: REST::FilterKeywordSerializer, if: :rules_requested?
|
||||
has_many :statuses, serializer: REST::FilterStatusSerializer, if: :rules_requested?
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
|
||||
13
app/serializers/rest/filter_status_serializer.rb
Normal file
13
app/serializers/rest/filter_status_serializer.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::FilterStatusSerializer < ActiveModel::Serializer
|
||||
attributes :id, :status_id
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def status_id
|
||||
object.status_id.to_s
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user