mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Add api_versions
to /api/v2/instance
This commit is contained in:
parent
6ca731e9b6
commit
31ed76fb6c
2 changed files with 17 additions and 1 deletions
|
@ -11,7 +11,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
|
|
||||||
attributes :domain, :title, :version, :source_url, :description,
|
attributes :domain, :title, :version, :source_url, :description,
|
||||||
:usage, :thumbnail, :languages, :configuration,
|
:usage, :thumbnail, :languages, :configuration,
|
||||||
:registrations
|
:registrations, :api_versions
|
||||||
|
|
||||||
has_one :contact, serializer: ContactSerializer
|
has_one :contact, serializer: ContactSerializer
|
||||||
has_many :rules, serializer: REST::RuleSerializer
|
has_many :rules, serializer: REST::RuleSerializer
|
||||||
|
@ -94,6 +94,12 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def api_versions
|
||||||
|
{
|
||||||
|
mastodon: 1,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def registrations_enabled?
|
def registrations_enabled?
|
||||||
|
|
|
@ -18,6 +18,7 @@ describe 'Instances' do
|
||||||
expect(body_as_json)
|
expect(body_as_json)
|
||||||
.to be_present
|
.to be_present
|
||||||
.and include(title: 'Mastodon')
|
.and include(title: 'Mastodon')
|
||||||
|
.and include_api_versions
|
||||||
.and include_configuration_limits
|
.and include_configuration_limits
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -32,6 +33,7 @@ describe 'Instances' do
|
||||||
expect(body_as_json)
|
expect(body_as_json)
|
||||||
.to be_present
|
.to be_present
|
||||||
.and include(title: 'Mastodon')
|
.and include(title: 'Mastodon')
|
||||||
|
.and include_api_versions
|
||||||
.and include_configuration_limits
|
.and include_configuration_limits
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -53,5 +55,13 @@ describe 'Instances' do
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include_api_versions
|
||||||
|
include(
|
||||||
|
api_versions: include(
|
||||||
|
mastodon: anything
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue