mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-07 20:26:15 +00:00
Compare commits
3 Commits
3ad46816fc
...
acaac11c77
Author | SHA1 | Date | |
---|---|---|---|
![]() |
acaac11c77 | ||
![]() |
8b34daf254 | ||
![]() |
290f6d428d |
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Api::V2::InstancesController < Api::BaseController
|
||||
skip_before_action :require_authenticated_user!, unless: :limited_federation_mode?
|
||||
skip_before_action :require_authenticated_user!
|
||||
skip_around_action :set_locale
|
||||
|
||||
vary_by ''
|
||||
|
|
|
@ -95,11 +95,11 @@ class ActivityPub::Parser::StatusParser
|
|||
end
|
||||
|
||||
def favourites_count
|
||||
@object.dig(:likes, :totalItems)
|
||||
@object.dig('likes', 'totalItems')
|
||||
end
|
||||
|
||||
def reblogs_count
|
||||
@object.dig(:shares, :totalItems)
|
||||
@object.dig('shares', 'totalItems')
|
||||
end
|
||||
|
||||
def quote_policy
|
||||
|
|
|
@ -49,7 +49,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
def usage
|
||||
{
|
||||
users: {
|
||||
active_month: object.active_user_count(4),
|
||||
active_month: limited_federation? ? 0 : object.active_user_count(4),
|
||||
},
|
||||
}
|
||||
end
|
||||
|
@ -99,6 +99,8 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
translation: {
|
||||
enabled: TranslationService.configured?,
|
||||
},
|
||||
|
||||
closed_federation: limited_federation?,
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -127,6 +129,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
markdown.render(Setting.closed_registrations_message) if Setting.closed_registrations_message.present?
|
||||
end
|
||||
|
||||
def limited_federation?
|
||||
Rails.configuration.x.limited_federation_mode
|
||||
end
|
||||
|
||||
def markdown
|
||||
@markdown ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, no_images: true)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user