From d5e3996a18ee37fc4bdf5718632d3d19ac7a8c1b Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:39:31 +0100 Subject: [feature] Parse instance descriptors as markdown, show T&C on /about (#2481) * [feature] Parse instance descriptors as markdown, show T&C on /about * lint * remove unnecessary nullzero tags --- internal/api/client/instance/instancepatch_test.go | 50 ++++++++++++++++------ 1 file changed, 37 insertions(+), 13 deletions(-) (limited to 'internal/api/client/instance/instancepatch_test.go') diff --git a/internal/api/client/instance/instancepatch_test.go b/internal/api/client/instance/instancepatch_test.go index 420bcd79e..936d6efd9 100644 --- a/internal/api/client/instance/instancepatch_test.go +++ b/internal/api/client/instance/instancepatch_test.go @@ -78,8 +78,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() { "uri": "http://localhost:8080", "account_domain": "localhost:8080", "title": "Example Instance", - "description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "description": "

Here's a fuller description of the GoToSocial testrig instance.

This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing

Users on this instance:

If you need to edit the models for the testrig, you can do so at internal/testmodels.go.

", + "description_text": "Here's a fuller description of the GoToSocial testrig instance.\n\nThis instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing\n\nUsers on this instance:\n\n- @admin (admin!).\n- @1happyturtle (posts about turtles, we don't know why).\n- @the_mighty_zork (who knows).\n\nIf you need to edit the models for the testrig, you can do so at `+"`"+`internal/testmodels.go`+"`"+`.", "short_description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "someone@example.org", "version": "0.0.0-testrig", "languages": [ @@ -173,7 +175,9 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } - ] + ], + "terms": "

This is where a list of terms and conditions might go.

For example:

If you want to sign up on this instance, you oughta know that we:

  1. Will sell your data to whoever offers.
  2. Secure the server with password password wherever possible.
", + "terms_text": "This is where a list of terms and conditions might go.\n\nFor example:\n\nIf you want to sign up on this instance, you oughta know that we:\n\n1. Will sell your data to whoever offers.\n2. Secure the server with password `+"`"+`password`+"`"+` wherever possible." }`, dst.String()) } @@ -195,8 +199,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() { "uri": "http://localhost:8080", "account_domain": "localhost:8080", "title": "Geoff's Instance", - "description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "description": "

Here's a fuller description of the GoToSocial testrig instance.

This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing

Users on this instance:

If you need to edit the models for the testrig, you can do so at internal/testmodels.go.

", + "description_text": "Here's a fuller description of the GoToSocial testrig instance.\n\nThis instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing\n\nUsers on this instance:\n\n- @admin (admin!).\n- @1happyturtle (posts about turtles, we don't know why).\n- @the_mighty_zork (who knows).\n\nIf you need to edit the models for the testrig, you can do so at `+"`"+`internal/testmodels.go`+"`"+`.", "short_description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "admin@example.org", "version": "0.0.0-testrig", "languages": [ @@ -290,13 +296,15 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } - ] + ], + "terms": "

This is where a list of terms and conditions might go.

For example:

If you want to sign up on this instance, you oughta know that we:

  1. Will sell your data to whoever offers.
  2. Secure the server with password password wherever possible.
", + "terms_text": "This is where a list of terms and conditions might go.\n\nFor example:\n\nIf you want to sign up on this instance, you oughta know that we:\n\n1. Will sell your data to whoever offers.\n2. Secure the server with password `+"`"+`password`+"`"+` wherever possible." }`, dst.String()) } func (suite *InstancePatchTestSuite) TestInstancePatch3() { code, b := suite.instancePatch("", "", map[string][]string{ - "short_description": {"

This is some html, which is allowed in short descriptions.

"}, + "short_description": {"This is some html, which is allowed in short descriptions."}, }) if expectedCode := http.StatusOK; code != expectedCode { @@ -312,8 +320,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() { "uri": "http://localhost:8080", "account_domain": "localhost:8080", "title": "GoToSocial Testrig Instance", - "description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "description": "

Here's a fuller description of the GoToSocial testrig instance.

This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing

Users on this instance:

If you need to edit the models for the testrig, you can do so at internal/testmodels.go.

", + "description_text": "Here's a fuller description of the GoToSocial testrig instance.\n\nThis instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing\n\nUsers on this instance:\n\n- @admin (admin!).\n- @1happyturtle (posts about turtles, we don't know why).\n- @the_mighty_zork (who knows).\n\nIf you need to edit the models for the testrig, you can do so at `+"`"+`internal/testmodels.go`+"`"+`.", "short_description": "

This is some html, which is allowed in short descriptions.

", + "short_description_text": "This is some html, which is allowed in short descriptions.", "email": "admin@example.org", "version": "0.0.0-testrig", "languages": [ @@ -407,7 +417,9 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } - ] + ], + "terms": "

This is where a list of terms and conditions might go.

For example:

If you want to sign up on this instance, you oughta know that we:

  1. Will sell your data to whoever offers.
  2. Secure the server with password password wherever possible.
", + "terms_text": "This is where a list of terms and conditions might go.\n\nFor example:\n\nIf you want to sign up on this instance, you oughta know that we:\n\n1. Will sell your data to whoever offers.\n2. Secure the server with password `+"`"+`password`+"`"+` wherever possible." }`, dst.String()) } @@ -480,8 +492,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() { "uri": "http://localhost:8080", "account_domain": "localhost:8080", "title": "GoToSocial Testrig Instance", - "description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "description": "

Here's a fuller description of the GoToSocial testrig instance.

This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing

Users on this instance:

If you need to edit the models for the testrig, you can do so at internal/testmodels.go.

", + "description_text": "Here's a fuller description of the GoToSocial testrig instance.\n\nThis instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing\n\nUsers on this instance:\n\n- @admin (admin!).\n- @1happyturtle (posts about turtles, we don't know why).\n- @the_mighty_zork (who knows).\n\nIf you need to edit the models for the testrig, you can do so at `+"`"+`internal/testmodels.go`+"`"+`.", "short_description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "", "version": "0.0.0-testrig", "languages": [ @@ -575,7 +589,9 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } - ] + ], + "terms": "

This is where a list of terms and conditions might go.

For example:

If you want to sign up on this instance, you oughta know that we:

  1. Will sell your data to whoever offers.
  2. Secure the server with password password wherever possible.
", + "terms_text": "This is where a list of terms and conditions might go.\n\nFor example:\n\nIf you want to sign up on this instance, you oughta know that we:\n\n1. Will sell your data to whoever offers.\n2. Secure the server with password `+"`"+`password`+"`"+` wherever possible." }`, dst.String()) } @@ -619,8 +635,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() { "uri": "http://localhost:8080", "account_domain": "localhost:8080", "title": "GoToSocial Testrig Instance", - "description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "description": "

Here's a fuller description of the GoToSocial testrig instance.

This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing

Users on this instance:

If you need to edit the models for the testrig, you can do so at internal/testmodels.go.

", + "description_text": "Here's a fuller description of the GoToSocial testrig instance.\n\nThis instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing\n\nUsers on this instance:\n\n- @admin (admin!).\n- @1happyturtle (posts about turtles, we don't know why).\n- @the_mighty_zork (who knows).\n\nIf you need to edit the models for the testrig, you can do so at `+"`"+`internal/testmodels.go`+"`"+`.", "short_description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "admin@example.org", "version": "0.0.0-testrig", "languages": [ @@ -716,7 +734,9 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } - ] + ], + "terms": "

This is where a list of terms and conditions might go.

For example:

If you want to sign up on this instance, you oughta know that we:

  1. Will sell your data to whoever offers.
  2. Secure the server with password password wherever possible.
", + "terms_text": "This is where a list of terms and conditions might go.\n\nFor example:\n\nIf you want to sign up on this instance, you oughta know that we:\n\n1. Will sell your data to whoever offers.\n2. Secure the server with password `+"`"+`password`+"`"+` wherever possible." }`, dst.String()) // extra bonus: check the v2 model thumbnail after the patch @@ -773,8 +793,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() { "uri": "http://localhost:8080", "account_domain": "localhost:8080", "title": "GoToSocial Testrig Instance", - "description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "description": "

Here's a fuller description of the GoToSocial testrig instance.

This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing

Users on this instance:

If you need to edit the models for the testrig, you can do so at internal/testmodels.go.

", + "description_text": "Here's a fuller description of the GoToSocial testrig instance.\n\nThis instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing\n\nUsers on this instance:\n\n- @admin (admin!).\n- @1happyturtle (posts about turtles, we don't know why).\n- @the_mighty_zork (who knows).\n\nIf you need to edit the models for the testrig, you can do so at `+"`"+`internal/testmodels.go`+"`"+`.", "short_description": "

This is the GoToSocial testrig. It doesn't federate or anything.

When the testrig is shut down, all data on it will be deleted.

Don't use this in production!

", + "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "admin@example.org", "version": "0.0.0-testrig", "languages": [ @@ -868,7 +890,9 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } - ] + ], + "terms": "

This is where a list of terms and conditions might go.

For example:

If you want to sign up on this instance, you oughta know that we:

  1. Will sell your data to whoever offers.
  2. Secure the server with password password wherever possible.
", + "terms_text": "This is where a list of terms and conditions might go.\n\nFor example:\n\nIf you want to sign up on this instance, you oughta know that we:\n\n1. Will sell your data to whoever offers.\n2. Secure the server with password `+"`"+`password`+"`"+` wherever possible." }`, dst.String()) } -- cgit v1.2.3