Fix image description unnecessarily html-escaping innocent characters (#321)

* implement SanitizeCaption function

* tidy up text test setup
This commit is contained in:
tobi 2021-11-22 11:49:11 +01:00 committed by GitHub
commit 24f9e11221
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 138 additions and 105 deletions

View file

@ -25,8 +25,6 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/text"
"github.com/superseriousbusiness/gotosocial/testrig"
)
const (
@ -74,30 +72,6 @@ type CommonTestSuite struct {
TextStandardTestSuite
}
func (suite *CommonTestSuite) SetupSuite() {
suite.testTokens = testrig.NewTestTokens()
suite.testClients = testrig.NewTestClients()
suite.testApplications = testrig.NewTestApplications()
suite.testUsers = testrig.NewTestUsers()
suite.testAccounts = testrig.NewTestAccounts()
suite.testAttachments = testrig.NewTestAttachments()
suite.testStatuses = testrig.NewTestStatuses()
suite.testTags = testrig.NewTestTags()
suite.testMentions = testrig.NewTestMentions()
}
func (suite *CommonTestSuite) SetupTest() {
suite.config = testrig.NewTestConfig()
suite.db = testrig.NewTestDB()
suite.formatter = text.NewFormatter(suite.config, suite.db)
testrig.StandardDBSetup(suite.db, nil)
}
func (suite *CommonTestSuite) TearDownTest() {
testrig.StandardDBTeardown(suite.db)
}
func (suite *CommonTestSuite) TestReplaceMentions() {
foundMentions := []*gtsmodel.Mention{
suite.testMentions["zork_mention_foss_satan"],