diff options
author | 2022-09-27 14:27:53 +0200 | |
---|---|---|
committer | 2022-09-27 14:27:53 +0200 | |
commit | 00d38855d416e834c2657271823e0ee95397d7ba (patch) | |
tree | c87d85e5c5c0be0c002e2757c63fe26253e5467a /internal/processing/status/create_test.go | |
parent | [performance] Update indexes that were causing slow db queries (#855) (diff) | |
download | gotosocial-00d38855d416e834c2657271823e0ee95397d7ba.tar.xz |
[bugfix] Fix emphasis being added to emoji shortcodes with markdown parsing (#856)v0.5.0
* fix underscored emoji shortcodes being emphasized
* remove footnote parsing from md
Diffstat (limited to 'internal/processing/status/create_test.go')
-rw-r--r-- | internal/processing/status/create_test.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/internal/processing/status/create_test.go b/internal/processing/status/create_test.go index c92148108..bccd47a1c 100644 --- a/internal/processing/status/create_test.go +++ b/internal/processing/status/create_test.go @@ -24,6 +24,8 @@ import ( "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/api/model" + "github.com/superseriousbusiness/gotosocial/internal/db" + "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" ) type StatusCreateTestSuite struct { @@ -98,6 +100,45 @@ func (suite *StatusCreateTestSuite) TestProcessContentWarningWithHTMLEscapedQuot suite.Equal("\"test\"", apiStatus.SpoilerText) } +func (suite *StatusCreateTestSuite) TestProcessStatusMarkdownWithUnderscoreEmoji() { + ctx := context.Background() + + // update the shortcode of the rainbow emoji to surround it in underscores + if err := suite.db.UpdateWhere(ctx, []db.Where{{Key: "shortcode", Value: "rainbow"}}, "shortcode", "_rainbow_", >smodel.Emoji{}); err != nil { + suite.FailNow(err.Error()) + } + + creatingAccount := suite.testAccounts["local_account_1"] + creatingApplication := suite.testApplications["application_1"] + + statusCreateForm := &model.AdvancedStatusCreateForm{ + StatusCreateRequest: model.StatusCreateRequest{ + Status: "poopoo peepee :_rainbow_:", + MediaIDs: []string{}, + Poll: nil, + InReplyToID: "", + Sensitive: false, + Visibility: model.VisibilityPublic, + ScheduledAt: "", + Language: "en", + Format: model.StatusFormatMarkdown, + }, + AdvancedVisibilityFlagsForm: model.AdvancedVisibilityFlagsForm{ + Federated: nil, + Boostable: nil, + Replyable: nil, + Likeable: nil, + }, + } + + apiStatus, err := suite.status.Create(ctx, creatingAccount, creatingApplication, statusCreateForm) + suite.NoError(err) + suite.NotNil(apiStatus) + + suite.Equal("<p>poopoo peepee :_rainbow_:</p>", apiStatus.Content) + suite.NotEmpty(apiStatus.Emojis) +} + func TestStatusCreateTestSuite(t *testing.T) { suite.Run(t, new(StatusCreateTestSuite)) } |