diff --git a/internal/processing/status/create_test.go b/internal/processing/status/create_test.go index bccd47a1c..98d6c9ffe 100644 --- a/internal/processing/status/create_test.go +++ b/internal/processing/status/create_test.go @@ -139,6 +139,41 @@ func (suite *StatusCreateTestSuite) TestProcessStatusMarkdownWithUnderscoreEmoji suite.NotEmpty(apiStatus.Emojis) } +func (suite *StatusCreateTestSuite) TestProcessStatusMarkdownWithSpoilerTextEmoji() { + ctx := context.Background() + creatingAccount := suite.testAccounts["local_account_1"] + creatingApplication := suite.testApplications["application_1"] + + statusCreateForm := &model.AdvancedStatusCreateForm{ + StatusCreateRequest: model.StatusCreateRequest{ + Status: "poopoo peepee", + SpoilerText: "testing something :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("

poopoo peepee

", apiStatus.Content) + suite.Equal("testing something :rainbow:", apiStatus.SpoilerText) + suite.NotEmpty(apiStatus.Emojis) +} + func TestStatusCreateTestSuite(t *testing.T) { suite.Run(t, new(StatusCreateTestSuite)) } diff --git a/internal/processing/status/util.go b/internal/processing/status/util.go index d3fc8f3b1..7617894cc 100644 --- a/internal/processing/status/util.go +++ b/internal/processing/status/util.go @@ -250,7 +250,7 @@ func (p *processor) ProcessTags(ctx context.Context, form *apimodel.AdvancedStat func (p *processor) ProcessEmojis(ctx context.Context, form *apimodel.AdvancedStatusCreateForm, accountID string, status *gtsmodel.Status) error { // for each emoji shortcode in the text, check if it's an enabled // emoji on this instance, and if so, add it to the status - emojiShortcodes := util.DeriveEmojisFromText(form.Status) + emojiShortcodes := util.DeriveEmojisFromText(form.SpoilerText + "\n\n" + form.Status) status.Emojis = make([]*gtsmodel.Emoji, 0, len(emojiShortcodes)) status.EmojiIDs = make([]string, 0, len(emojiShortcodes))