diff options
author | 2024-09-16 14:00:23 +0200 | |
---|---|---|
committer | 2024-09-16 14:00:23 +0200 | |
commit | efd1a4f717afa83d3d3609f0d70e4da151a8dc9b (patch) | |
tree | 246ae4c12f86f8866e5299ae39ba5c1feba0bce4 /internal/typeutils/internaltofrontend_test.go | |
parent | [bugfix/chore] Always set the status sensitive if media + content-warning pre... (diff) | |
download | gotosocial-efd1a4f717afa83d3d3609f0d70e4da151a8dc9b.tar.xz |
[bugfix] Use better plaintext representation of status for filtering (#3301)
* [bugfix] Use better plaintext representation of status for filtering
* add new deps to readme
* lint
* update tests
* update regexes
* address review comments
* remove now unused xxhash
* whoops, wrong logger
* Merge branch 'main' into status_filtering_bugfix
* put cache in caches struct
* pain
Diffstat (limited to 'internal/typeutils/internaltofrontend_test.go')
-rw-r--r-- | internal/typeutils/internaltofrontend_test.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/internal/typeutils/internaltofrontend_test.go b/internal/typeutils/internaltofrontend_test.go index 651ff867d..a44afe67e 100644 --- a/internal/typeutils/internaltofrontend_test.go +++ b/internal/typeutils/internaltofrontend_test.go @@ -1063,15 +1063,21 @@ func (suite *InternalToFrontendTestSuite) TestHideFilteredBoostToFrontend() { // Test that a hashtag filter for a hashtag in Mastodon HTML content works the way most users would expect. func (suite *InternalToFrontendTestSuite) testHashtagFilteredStatusToFrontend(wholeWord bool, boost bool) { - testStatus := suite.testStatuses["admin_account_status_1"] + testStatus := new(gtsmodel.Status) + *testStatus = *suite.testStatuses["admin_account_status_1"] testStatus.Content = `<p>doggo doggin' it</p><p><a href="https://example.test/tags/dogsofmastodon" class="mention hashtag" rel="tag nofollow noreferrer noopener" target="_blank">#<span>dogsofmastodon</span></a></p>` if boost { - // Modify a fixture boost into a boost of the above status. - boostStatus := suite.testStatuses["admin_account_status_4"] - boostStatus.BoostOf = testStatus - boostStatus.BoostOfID = testStatus.ID - testStatus = boostStatus + boost, err := suite.typeconverter.StatusToBoost( + context.Background(), + testStatus, + suite.testAccounts["admin_account"], + "", + ) + if err != nil { + suite.FailNow(err.Error()) + } + testStatus = boost } requestingAccount := suite.testAccounts["local_account_1"] @@ -1103,9 +1109,11 @@ func (suite *InternalToFrontendTestSuite) testHashtagFilteredStatusToFrontend(wh []*gtsmodel.Filter{filter}, nil, ) - if suite.NoError(err) { - suite.NotEmpty(apiStatus.Filtered) + if err != nil { + suite.FailNow(err.Error()) } + + suite.NotEmpty(apiStatus.Filtered) } func (suite *InternalToFrontendTestSuite) TestHashtagWholeWordFilteredStatusToFrontend() { |