Merge commit 'b9f59ebcc68e9da0a7158741a1a2ef3564e1321e' into merging-upstream
This commit is contained in:
@@ -7,6 +7,10 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||
:note, :url, :avatar, :avatar_static, :header, :header_static,
|
||||
:followers_count, :following_count, :statuses_count
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def note
|
||||
Formatter.instance.simplified_format(object)
|
||||
end
|
||||
|
@@ -4,6 +4,10 @@ class REST::ApplicationSerializer < ActiveModel::Serializer
|
||||
attributes :id, :name, :website, :redirect_uri,
|
||||
:client_id, :client_secret
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def client_id
|
||||
object.uid
|
||||
end
|
||||
|
11
app/serializers/rest/custom_emoji_serializer.rb
Normal file
11
app/serializers/rest/custom_emoji_serializer.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::CustomEmojiSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
attributes :shortcode, :url
|
||||
|
||||
def url
|
||||
full_asset_url(object.image.url)
|
||||
end
|
||||
end
|
@@ -6,6 +6,10 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer
|
||||
attributes :id, :type, :url, :preview_url,
|
||||
:remote_url, :text_url, :meta
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def url
|
||||
if object.needs_redownload?
|
||||
media_proxy_url(object.id, :original)
|
||||
|
@@ -6,6 +6,10 @@ class REST::NotificationSerializer < ActiveModel::Serializer
|
||||
belongs_to :from_account, key: :account, serializer: REST::AccountSerializer
|
||||
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def status_type?
|
||||
[:favourite, :reblog, :mention].include?(object.type)
|
||||
end
|
||||
|
@@ -4,6 +4,10 @@ class REST::RelationshipSerializer < ActiveModel::Serializer
|
||||
attributes :id, :following, :followed_by, :blocking,
|
||||
:muting, :requested, :domain_blocking
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def following
|
||||
instance_options[:relationships].following[object.id] || false
|
||||
end
|
||||
|
@@ -2,4 +2,8 @@
|
||||
|
||||
class REST::ReportSerializer < ActiveModel::Serializer
|
||||
attributes :id, :action_taken
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
end
|
||||
|
@@ -17,14 +17,26 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
||||
has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
|
||||
has_many :mentions
|
||||
has_many :tags
|
||||
has_many :emojis
|
||||
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def in_reply_to_id
|
||||
object.in_reply_to_id&.to_s
|
||||
end
|
||||
|
||||
def in_reply_to_account_id
|
||||
object.in_reply_to_account_id&.to_s
|
||||
end
|
||||
|
||||
def current_user?
|
||||
!current_user.nil?
|
||||
end
|
||||
|
||||
def uri
|
||||
TagManager.instance.uri_for(object)
|
||||
OStatus::TagManager.instance.uri_for(object)
|
||||
end
|
||||
|
||||
def content
|
||||
@@ -82,7 +94,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
||||
attributes :id, :username, :url, :acct
|
||||
|
||||
def id
|
||||
object.account_id
|
||||
object.account_id.to_s
|
||||
end
|
||||
|
||||
def username
|
||||
@@ -107,14 +119,4 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
||||
tag_url(object)
|
||||
end
|
||||
end
|
||||
|
||||
class CustomEmojiSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
attributes :shortcode, :url
|
||||
|
||||
def url
|
||||
full_asset_url(object.image.url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user