Merge tag 'v3.1.4' into hometown-dev
This commit is contained in:
@ -4,7 +4,7 @@ class OEmbedSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
attributes :type, :version, :title, :author_name,
|
||||
attributes :type, :version, :author_name,
|
||||
:author_url, :provider_name, :provider_url,
|
||||
:cache_age, :html, :width, :height
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ class REST::AnnouncementSerializer < ActiveModel::Serializer
|
||||
attribute :read, if: :current_user?
|
||||
|
||||
has_many :mentions
|
||||
has_many :statuses
|
||||
has_many :tags, serializer: REST::StatusSerializer::TagSerializer
|
||||
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
||||
has_many :reactions, serializer: REST::ReactionSerializer
|
||||
@ -46,4 +47,16 @@ class REST::AnnouncementSerializer < ActiveModel::Serializer
|
||||
object.pretty_acct
|
||||
end
|
||||
end
|
||||
|
||||
class StatusSerializer < ActiveModel::Serializer
|
||||
attributes :id, :url
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def url
|
||||
ActivityPub::TagManager.instance.url_for(object)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -5,7 +5,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||
|
||||
attributes :uri, :title, :short_description, :description, :email,
|
||||
:version, :urls, :stats, :thumbnail,
|
||||
:languages, :registrations, :approval_required
|
||||
:languages, :registrations, :approval_required, :invites_enabled
|
||||
|
||||
has_one :contact_account, serializer: REST::AccountSerializer
|
||||
|
||||
@ -63,6 +63,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||
Setting.registrations_mode == 'approved'
|
||||
end
|
||||
|
||||
def invites_enabled
|
||||
Setting.min_invite_role == 'user'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def instance_presenter
|
||||
|
||||
@ -12,7 +12,9 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer
|
||||
end
|
||||
|
||||
def url
|
||||
if object.needs_redownload?
|
||||
if object.not_processed?
|
||||
nil
|
||||
elsif object.needs_redownload?
|
||||
media_proxy_url(object.id, :original)
|
||||
else
|
||||
full_asset_url(object.file.url(:original))
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RSS::AccountSerializer
|
||||
class RSS::AccountSerializer < RSS::Serializer
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include AccountsHelper
|
||||
include RoutingHelper
|
||||
@ -17,18 +17,7 @@ class RSS::AccountSerializer
|
||||
builder.image(full_asset_url(account.avatar.url(:original))) if account.avatar?
|
||||
builder.cover(full_asset_url(account.header.url(:original))) if account.header?
|
||||
|
||||
statuses.each do |status|
|
||||
builder.item do |item|
|
||||
item.title(status.title)
|
||||
.link(ActivityPub::TagManager.instance.url_for(status))
|
||||
.pub_date(status.created_at)
|
||||
.description(status.spoiler_text.presence || Formatter.instance.format(status, inline_poll_options: true).to_str)
|
||||
|
||||
status.media_attachments.each do |media|
|
||||
item.enclosure(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size)
|
||||
end
|
||||
end
|
||||
end
|
||||
render_statuses(builder, statuses)
|
||||
|
||||
builder.to_xml
|
||||
end
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RSS::TagSerializer
|
||||
class RSS::TagSerializer < RSS::Serializer
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include ActionView::Helpers::SanitizeHelper
|
||||
include RoutingHelper
|
||||
@ -14,18 +14,7 @@ class RSS::TagSerializer
|
||||
.logo(full_pack_url('media/images/logo.svg'))
|
||||
.accent_color('2b90d9')
|
||||
|
||||
statuses.each do |status|
|
||||
builder.item do |item|
|
||||
item.title(status.title)
|
||||
.link(ActivityPub::TagManager.instance.url_for(status))
|
||||
.pub_date(status.created_at)
|
||||
.description(status.spoiler_text.presence || Formatter.instance.format(status).to_str)
|
||||
|
||||
status.media_attachments.each do |media|
|
||||
item.enclosure(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size)
|
||||
end
|
||||
end
|
||||
end
|
||||
render_statuses(builder, statuses)
|
||||
|
||||
builder.to_xml
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user