diff options
author | 2022-05-07 16:55:27 +0100 | |
---|---|---|
committer | 2022-05-07 17:55:27 +0200 | |
commit | 26b74aefaf5d2a3cd26bd57652fe96a6a20ed034 (patch) | |
tree | db316febba8e0ada7a9360b059011dcc7ea138a3 /internal/processing | |
parent | [performance] improved logrus output switching performance (#544) (diff) | |
download | gotosocial-26b74aefaf5d2a3cd26bd57652fe96a6a20ed034.tar.xz |
[bugfix] Fix existing bio text showing as HTML (#531)
* fix existing bio text showing as HTML
- updated replaced mentions to include instance
- strips HTML from account source note in Verify handler
- update text formatter to use buffers for string writes
Signed-off-by: kim <grufwub@gmail.com>
* go away linter
Signed-off-by: kim <grufwub@gmail.com>
* change buf reset location, change html mention tags
Signed-off-by: kim <grufwub@gmail.com>
* reduce FindLinks code complexity
Signed-off-by: kim <grufwub@gmail.com>
* fix HTML to text conversion
Signed-off-by: kim <grufwub@gmail.com>
* Update internal/regexes/regexes.go
Co-authored-by: Mina Galić <mina.galic@puppet.com>
* use improved html2text lib with more options
Signed-off-by: kim <grufwub@gmail.com>
* fix to produce actual plaintext from html
Signed-off-by: kim <grufwub@gmail.com>
* fix span tags instead written as space
Signed-off-by: kim <grufwub@gmail.com>
* performance improvements to regex replacements, fix link replace logic for un-html-ing in the future
Signed-off-by: kim <grufwub@gmail.com>
* fix tag/mention replacements to use input string, fix link replace to not include scheme
Signed-off-by: kim <grufwub@gmail.com>
* use matched input string for link replace href text
Signed-off-by: kim <grufwub@gmail.com>
* remove unused code (to appease linter :sobs:)
Signed-off-by: kim <grufwub@gmail.com>
* improve hashtagFinger regex to be more compliant
Signed-off-by: kim <grufwub@gmail.com>
* update breakReplacer to include both unix and windows line endings
Signed-off-by: kim <grufwub@gmail.com>
* add NoteRaw field to Account to store plaintext account bio, add migration for this, set for sensitive accounts
Signed-off-by: kim <grufwub@gmail.com>
* drop unnecessary code
Signed-off-by: kim <grufwub@gmail.com>
* update text package tests to fix logic changes
Signed-off-by: kim <grufwub@gmail.com>
* add raw note content testing to account update and account verify
Signed-off-by: kim <grufwub@gmail.com>
* remove unused modules
Signed-off-by: kim <grufwub@gmail.com>
* fix emoji regex
Signed-off-by: kim <grufwub@gmail.com>
* fix replacement of hashtags
Signed-off-by: kim <grufwub@gmail.com>
* update code comment
Signed-off-by: kim <grufwub@gmail.com>
Co-authored-by: Mina Galić <mina.galic@puppet.com>
Diffstat (limited to 'internal/processing')
-rw-r--r-- | internal/processing/account/update.go | 7 | ||||
-rw-r--r-- | internal/processing/status/create.go | 6 | ||||
-rw-r--r-- | internal/processing/status/util.go | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go index 738aa8c88..3d6bbae2a 100644 --- a/internal/processing/account/update.go +++ b/internal/processing/account/update.go @@ -60,10 +60,17 @@ func (p *processor) Update(ctx context.Context, account *gtsmodel.Account, form if err := validate.Note(*form.Note); err != nil { return nil, err } + + // Set the raw note before processing + account.NoteRaw = *form.Note + + // Process note to generate a valid HTML representation note, err := p.processNote(ctx, *form.Note, account.ID) if err != nil { return nil, err } + + // Set updated HTML-ified note account.Note = note } diff --git a/internal/processing/status/create.go b/internal/processing/status/create.go index 1e93af162..add8a5bc6 100644 --- a/internal/processing/status/create.go +++ b/internal/processing/status/create.go @@ -39,13 +39,11 @@ func (p *processor) Create(ctx context.Context, account *gtsmodel.Account, appli if err != nil { return nil, gtserror.NewErrorInternalError(err) } - thisStatusURI := fmt.Sprintf("%s/%s", accountURIs.StatusesURI, thisStatusID) - thisStatusURL := fmt.Sprintf("%s/%s", accountURIs.StatusesURL, thisStatusID) newStatus := >smodel.Status{ ID: thisStatusID, - URI: thisStatusURI, - URL: thisStatusURL, + URI: accountURIs.StatusesURI + "/" + thisStatusID, + URL: accountURIs.StatusesURL + "/" + thisStatusID, CreatedAt: time.Now(), UpdatedAt: time.Now(), Local: true, diff --git a/internal/processing/status/util.go b/internal/processing/status/util.go index 5de66af8a..190d88f1b 100644 --- a/internal/processing/status/util.go +++ b/internal/processing/status/util.go @@ -242,11 +242,11 @@ 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 { - emojis := []string{} gtsEmojis, err := p.db.EmojiStringsToEmojis(ctx, util.DeriveEmojisFromText(form.Status)) if err != nil { return fmt.Errorf("error generating emojis from status: %s", err) } + emojis := make([]string, 0, len(gtsEmojis)) for _, e := range gtsEmojis { emojis = append(emojis, e.ID) } |