[bugfix] Return languages in api/v1/instance (#1741)
It turns out that in Masto v2.3.0 the languages key was added to the V1
Instance and that it's effectively mandatory. Though in GtS we don't
really have this concept yet, some apps will explode if the languages
key is missing altogether. So at least return the empty array on V1 too
in the hopes that it makes things work well enough.
For history's sake, you can see the attributes that will get serialised
in
f877aa9d70/app/serializers/rest/v1/instance_serializer.rb (L6-L9)
.
Because the attribute does not have a conditional defined for it,
there isn't a filter that optionally omits it, or a def languages to
modify the behaviour the attribute is effectively always included and
serialised.
Fixes: #1662
This commit is contained in:
parent
6d138588d8
commit
b7dd32da42
|
@ -82,6 +82,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() {
|
|||
"short_description": "\u003cp\u003eThis is the GoToSocial testrig. It doesn't federate or anything.\u003c/p\u003e\u003cp\u003eWhen the testrig is shut down, all data on it will be deleted.\u003c/p\u003e\u003cp\u003eDon't use this in production!\u003c/p\u003e",
|
||||
"email": "someone@example.org",
|
||||
"version": "0.0.0-testrig",
|
||||
"languages": [],
|
||||
"registrations": true,
|
||||
"approval_required": true,
|
||||
"invites_enabled": false,
|
||||
|
@ -184,6 +185,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() {
|
|||
"short_description": "\u003cp\u003eThis is the GoToSocial testrig. It doesn't federate or anything.\u003c/p\u003e\u003cp\u003eWhen the testrig is shut down, all data on it will be deleted.\u003c/p\u003e\u003cp\u003eDon't use this in production!\u003c/p\u003e",
|
||||
"email": "admin@example.org",
|
||||
"version": "0.0.0-testrig",
|
||||
"languages": [],
|
||||
"registrations": true,
|
||||
"approval_required": true,
|
||||
"invites_enabled": false,
|
||||
|
@ -286,6 +288,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() {
|
|||
"short_description": "\u003cp\u003eThis is some html, which is \u003cem\u003eallowed\u003c/em\u003e in short descriptions.\u003c/p\u003e",
|
||||
"email": "admin@example.org",
|
||||
"version": "0.0.0-testrig",
|
||||
"languages": [],
|
||||
"registrations": true,
|
||||
"approval_required": true,
|
||||
"invites_enabled": false,
|
||||
|
@ -439,6 +442,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() {
|
|||
"short_description": "\u003cp\u003eThis is the GoToSocial testrig. It doesn't federate or anything.\u003c/p\u003e\u003cp\u003eWhen the testrig is shut down, all data on it will be deleted.\u003c/p\u003e\u003cp\u003eDon't use this in production!\u003c/p\u003e",
|
||||
"email": "",
|
||||
"version": "0.0.0-testrig",
|
||||
"languages": [],
|
||||
"registrations": true,
|
||||
"approval_required": true,
|
||||
"invites_enabled": false,
|
||||
|
@ -563,6 +567,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() {
|
|||
"short_description": "\u003cp\u003eThis is the GoToSocial testrig. It doesn't federate or anything.\u003c/p\u003e\u003cp\u003eWhen the testrig is shut down, all data on it will be deleted.\u003c/p\u003e\u003cp\u003eDon't use this in production!\u003c/p\u003e",
|
||||
"email": "admin@example.org",
|
||||
"version": "0.0.0-testrig",
|
||||
"languages": [],
|
||||
"registrations": true,
|
||||
"approval_required": true,
|
||||
"invites_enabled": false,
|
||||
|
@ -702,6 +707,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() {
|
|||
"short_description": "\u003cp\u003eThis is the GoToSocial testrig. It doesn't federate or anything.\u003c/p\u003e\u003cp\u003eWhen the testrig is shut down, all data on it will be deleted.\u003c/p\u003e\u003cp\u003eDon't use this in production!\u003c/p\u003e",
|
||||
"email": "admin@example.org",
|
||||
"version": "0.0.0-testrig",
|
||||
"languages": [],
|
||||
"registrations": true,
|
||||
"approval_required": true,
|
||||
"invites_enabled": false,
|
||||
|
|
|
@ -57,7 +57,7 @@ type InstanceV1 struct {
|
|||
Version string `json:"version"`
|
||||
// Primary language of the instance.
|
||||
// example: en
|
||||
Languages []string `json:"languages,omitempty"`
|
||||
Languages []string `json:"languages"`
|
||||
// New account registrations are enabled on this instance.
|
||||
Registrations bool `json:"registrations"`
|
||||
// New account registrations require admin approval.
|
||||
|
|
|
@ -497,6 +497,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() {
|
|||
"short_description": "\u003cp\u003eThis is the GoToSocial testrig. It doesn't federate or anything.\u003c/p\u003e\u003cp\u003eWhen the testrig is shut down, all data on it will be deleted.\u003c/p\u003e\u003cp\u003eDon't use this in production!\u003c/p\u003e",
|
||||
"email": "admin@example.org",
|
||||
"version": "0.0.0-testrig",
|
||||
"languages": [],
|
||||
"registrations": true,
|
||||
"approval_required": true,
|
||||
"invites_enabled": false,
|
||||
|
|
Loading…
Reference in New Issue