From f0f3bc52dca81ca0cec5d68dd685f08ab3c7e8bb Mon Sep 17 00:00:00 2001 From: kim Date: Mon, 23 Dec 2024 13:49:48 +0000 Subject: [PATCH] fix status source test --- internal/api/client/statuses/statussource_test.go | 2 +- internal/processing/status/common.go | 5 +++++ internal/processing/status/create.go | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/api/client/statuses/statussource_test.go b/internal/api/client/statuses/statussource_test.go index 28b1e6852..797a462ed 100644 --- a/internal/api/client/statuses/statussource_test.go +++ b/internal/api/client/statuses/statussource_test.go @@ -91,7 +91,7 @@ func (suite *StatusSourceTestSuite) TestGetSource() { suite.Equal(`{ "id": "01F8MHAMCHF6Y650WCRSCP4WMY", - "text": "**STATUS EDITS ARE NOT CURRENTLY SUPPORTED IN GOTOSOCIAL (coming in 2024)**\nYou can review the original text of your status below, but you will not be able to submit this edit.\n\n---\n\nhello everyone!", + "text": "hello everyone!", "spoiler_text": "introduction post" }`, dst.String()) } diff --git a/internal/processing/status/common.go b/internal/processing/status/common.go index 63faac5bc..f5c22a6b0 100644 --- a/internal/processing/status/common.go +++ b/internal/processing/status/common.go @@ -198,6 +198,11 @@ func (p *Processor) processContent( poll.Options = status.PollOptions } + // We may have received multiple copies of the same emoji, deduplicate these first. + status.Emojis = xslices.DeduplicateFunc(status.Emojis, func(e *gtsmodel.Emoji) string { + return e.ID + }) + // Gather up the IDs of mentions from parsed content. status.MentionIDs = xslices.Gather(nil, status.Mentions, func(m *gtsmodel.Mention) string { diff --git a/internal/processing/status/create.go b/internal/processing/status/create.go index b61f952b7..af9831b9c 100644 --- a/internal/processing/status/create.go +++ b/internal/processing/status/create.go @@ -54,7 +54,7 @@ func (p *Processor) Create( return nil, errWithCode } - // Ensure account populated; we'll need settings. + // Ensure account populated; we'll need their settings. if err := p.state.DB.PopulateAccount(ctx, requester); err != nil { log.Errorf(ctx, "error(s) populating account, will continue: %s", err) }