From cfefbc08d822cd85787d95dc2ee253e3368826d8 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:13:30 +0100 Subject: [feature] Federate status language in and out (#2366) * [feature] Federate status language in + out * go fmt * tests, little fix * improve comments * unnest a bit * avoid unnecessary nil check * use more descriptive variable for contentMap * prefer instance languages when selecting from contentMap * update docs to reflect lang selection * rename rdfLangString -> rdfLangs * update comments to mention Pollable * iter through slice instead of map --- internal/typeutils/astointernal_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'internal/typeutils/astointernal_test.go') diff --git a/internal/typeutils/astointernal_test.go b/internal/typeutils/astointernal_test.go index 10ea422fa..851d57efc 100644 --- a/internal/typeutils/astointernal_test.go +++ b/internal/typeutils/astointernal_test.go @@ -45,6 +45,10 @@ func (suite *ASToInternalTestSuite) jsonToType(in string) vocab.Type { suite.FailNow(err.Error()) } + if statusable, ok := t.(ap.Statusable); ok { + ap.NormalizeIncomingContent(statusable, m) + } + return t } @@ -103,7 +107,8 @@ func (suite *ASToInternalTestSuite) TestParsePublicStatus() { suite.NoError(err) suite.Equal("reading: Punishment and Reward in the Corporate University", status.ContentWarning) - suite.Equal(`

> So we have to examine critical thinking as a signifier, dynamic and ambiguous. It has a normative definition, a tacit definition, and an ideal definition. One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.

`, status.Content) + suite.Equal(`

> So we have to examine critical thinking as a signifier, dynamic and ambiguous. It has a normative definition, a tacit definition, and an ideal definition. One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.

`, status.Content) + suite.Equal("en", status.Language) } func (suite *ASToInternalTestSuite) TestParsePublicStatusNoURL() { @@ -117,7 +122,7 @@ func (suite *ASToInternalTestSuite) TestParsePublicStatusNoURL() { suite.NoError(err) suite.Equal("reading: Punishment and Reward in the Corporate University", status.ContentWarning) - suite.Equal(`

> So we have to examine critical thinking as a signifier, dynamic and ambiguous. It has a normative definition, a tacit definition, and an ideal definition. One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.

`, status.Content) + suite.Equal(`

> So we have to examine critical thinking as a signifier, dynamic and ambiguous. It has a normative definition, a tacit definition, and an ideal definition. One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.

`, status.Content) // on statuses with no URL in them (like ones we get from pleroma sometimes) we should use the AP URI of the status as URL suite.Equal("http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167", status.URL) -- cgit v1.2.3