mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 22:02:25 -05:00 
			
		
		
		
	fix emojis not showing in spoiler text (#878)
This commit is contained in:
		
					parent
					
						
							
								651303d970
							
						
					
				
			
			
				commit
				
					
						196e474e43
					
				
			
		
					 2 changed files with 36 additions and 1 deletions
				
			
		|  | @ -139,6 +139,41 @@ func (suite *StatusCreateTestSuite) TestProcessStatusMarkdownWithUnderscoreEmoji | ||||||
| 	suite.NotEmpty(apiStatus.Emojis) | 	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("<p>poopoo peepee</p>", apiStatus.Content) | ||||||
|  | 	suite.Equal("testing something :rainbow:", apiStatus.SpoilerText) | ||||||
|  | 	suite.NotEmpty(apiStatus.Emojis) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func TestStatusCreateTestSuite(t *testing.T) { | func TestStatusCreateTestSuite(t *testing.T) { | ||||||
| 	suite.Run(t, new(StatusCreateTestSuite)) | 	suite.Run(t, new(StatusCreateTestSuite)) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -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 { | 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 | 	// 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 | 	// 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.Emojis = make([]*gtsmodel.Emoji, 0, len(emojiShortcodes)) | ||||||
| 	status.EmojiIDs = make([]string, 0, len(emojiShortcodes)) | 	status.EmojiIDs = make([]string, 0, len(emojiShortcodes)) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue