Add initial support for ingesting and verifying remote quote posts (#34370)
This commit is contained in:
parent
a324edabdf
commit
df2611a10f
33 changed files with 1643 additions and 22 deletions
25
app/serializers/rest/base_quote_serializer.rb
Normal file
25
app/serializers/rest/base_quote_serializer.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::BaseQuoteSerializer < ActiveModel::Serializer
|
||||
attributes :state
|
||||
|
||||
def state
|
||||
return object.state unless object.accepted?
|
||||
|
||||
# Extra states when a status is unavailable
|
||||
return 'deleted' if object.quoted_status.nil?
|
||||
return 'unauthorized' if status_filter.filtered?
|
||||
|
||||
object.state
|
||||
end
|
||||
|
||||
def quoted_status
|
||||
object.quoted_status if object.accepted? && object.quoted_status.present? && !status_filter.filtered?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def status_filter
|
||||
@status_filter ||= StatusFilter.new(object.quoted_status, current_user&.account, instance_options[:relationships] || {})
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue