mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-08 20:51:09 -06:00
[feature] Parse content warning as HTML, serialize via API to plaintext
This commit is contained in:
parent
69461c461b
commit
22ce924129
47 changed files with 947 additions and 553 deletions
|
|
@ -98,7 +98,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
|
|||
}
|
||||
|
||||
// Parse new display name (always from plaintext).
|
||||
account.DisplayName = text.SanitizeToPlaintext(displayName)
|
||||
account.DisplayName = text.RemoveHTML(displayName)
|
||||
acctColumns = append(acctColumns, "display_name")
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
|
|||
}
|
||||
|
||||
if form.AvatarDescription != nil {
|
||||
desc := text.SanitizeToPlaintext(*form.AvatarDescription)
|
||||
desc := text.RemoveHTML(*form.AvatarDescription)
|
||||
form.AvatarDescription = &desc
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
|
|||
}
|
||||
|
||||
if form.HeaderDescription != nil {
|
||||
desc := text.SanitizeToPlaintext(*form.HeaderDescription)
|
||||
desc := text.RemoveHTML(*form.HeaderDescription)
|
||||
form.HeaderDescription = util.Ptr(desc)
|
||||
}
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
|
|||
return nil, gtserror.NewErrorBadRequest(err, err.Error())
|
||||
}
|
||||
|
||||
account.Settings.CustomCSS = text.SanitizeToPlaintext(customCSS)
|
||||
account.Settings.CustomCSS = text.RemoveHTML(customCSS)
|
||||
settingsColumns = append(settingsColumns, "custom_css")
|
||||
}
|
||||
|
||||
|
|
@ -356,8 +356,8 @@ func (p *Processor) updateFields(
|
|||
|
||||
// Sanitize raw field values.
|
||||
fieldRaw := >smodel.Field{
|
||||
Name: text.SanitizeToPlaintext(name),
|
||||
Value: text.SanitizeToPlaintext(value),
|
||||
Name: text.RemoveHTML(name),
|
||||
Value: text.RemoveHTML(value),
|
||||
}
|
||||
fieldsRaw = append(fieldsRaw, fieldRaw)
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ func (p *Processor) processAccountText(
|
|||
emojis := make(map[string]*gtsmodel.Emoji)
|
||||
|
||||
// Retrieve display name emojis.
|
||||
for _, emoji := range p.formatter.FromPlainEmojiOnly(
|
||||
for _, emoji := range p.formatter.FromPlainBasic(
|
||||
ctx,
|
||||
p.parseMention,
|
||||
account.ID,
|
||||
|
|
@ -413,7 +413,7 @@ func (p *Processor) processAccountText(
|
|||
// Name stays plain, but we still need to
|
||||
// see if there are any emojis set in it.
|
||||
field.Name = fieldRaw.Name
|
||||
for _, emoji := range p.formatter.FromPlainEmojiOnly(
|
||||
for _, emoji := range p.formatter.FromPlainBasic(
|
||||
ctx,
|
||||
p.parseMention,
|
||||
account.ID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue