mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-10 15:37:28 -06:00
rename some of the text functions for clarity
This commit is contained in:
parent
a05d4bac53
commit
c8556cfd97
16 changed files with 145 additions and 124 deletions
|
|
@ -97,8 +97,8 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
|
|||
return nil, gtserror.NewErrorBadRequest(err, err.Error())
|
||||
}
|
||||
|
||||
// Parse new display name (always from plaintext).
|
||||
account.DisplayName = text.RemoveHTML(displayName)
|
||||
// HTML tags not allowed in display name.
|
||||
account.DisplayName = text.StripHTMLFromText(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.RemoveHTML(*form.AvatarDescription)
|
||||
desc := text.StripHTMLFromText(*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.RemoveHTML(*form.HeaderDescription)
|
||||
desc := text.StripHTMLFromText(*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.RemoveHTML(customCSS)
|
||||
account.Settings.CustomCSS = text.StripHTMLFromText(customCSS)
|
||||
settingsColumns = append(settingsColumns, "custom_css")
|
||||
}
|
||||
|
||||
|
|
@ -356,8 +356,8 @@ func (p *Processor) updateFields(
|
|||
|
||||
// Sanitize raw field values.
|
||||
fieldRaw := >smodel.Field{
|
||||
Name: text.RemoveHTML(name),
|
||||
Value: text.RemoveHTML(value),
|
||||
Name: text.StripHTMLFromText(name),
|
||||
Value: text.StripHTMLFromText(value),
|
||||
}
|
||||
fieldsRaw = append(fieldsRaw, fieldRaw)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ func (p *Processor) createDomainAllow(
|
|||
ID: id.NewULID(),
|
||||
Domain: domain,
|
||||
CreatedByAccountID: adminAcct.ID,
|
||||
PrivateComment: text.RemoveHTML(privateComment),
|
||||
PublicComment: text.RemoveHTML(publicComment),
|
||||
PrivateComment: text.StripHTMLFromText(privateComment),
|
||||
PublicComment: text.StripHTMLFromText(publicComment),
|
||||
Obfuscate: &obfuscate,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ func (p *Processor) createDomainBlock(
|
|||
ID: id.NewULID(),
|
||||
Domain: domain,
|
||||
CreatedByAccountID: adminAcct.ID,
|
||||
PrivateComment: text.RemoveHTML(privateComment),
|
||||
PublicComment: text.RemoveHTML(publicComment),
|
||||
PrivateComment: text.StripHTMLFromText(privateComment),
|
||||
PublicComment: text.StripHTMLFromText(publicComment),
|
||||
Obfuscate: &obfuscate,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ func (p *Processor) InstancePatch(ctx context.Context, form *apimodel.InstanceSe
|
|||
}
|
||||
|
||||
// Don't allow html in site title.
|
||||
instance.Title = text.RemoveHTML(title)
|
||||
instance.Title = text.StripHTMLFromText(title)
|
||||
columns = append(columns, "title")
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ func (p *Processor) InstancePatch(ctx context.Context, form *apimodel.InstanceSe
|
|||
return nil, gtserror.NewErrorBadRequest(err, err.Error())
|
||||
}
|
||||
|
||||
instance.CustomCSS = text.RemoveHTML(customCSS)
|
||||
instance.CustomCSS = text.StripHTMLFromText(customCSS)
|
||||
columns = append(columns, []string{"custom_css"}...)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, media
|
|||
|
||||
// processDescription will sanitize and valid description against server configuration.
|
||||
func processDescription(description string) (string, gtserror.WithCode) {
|
||||
description = text.RemoveHTML(description)
|
||||
description = text.StripHTMLFromText(description)
|
||||
chars := len([]rune(description))
|
||||
|
||||
if min := config.GetMediaDescriptionMinChars(); chars < min {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ func (p *Processor) processContent(
|
|||
// Strip each poll option and format.
|
||||
//
|
||||
// For polls just use basic formatting.
|
||||
option = text.RemoveHTML(option)
|
||||
option = text.StripHTMLFromText(option)
|
||||
optionRes := formatInput(p.formatter.FromPlainBasic, option)
|
||||
|
||||
// Gather results of the formatted.
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ func (p *Processor) Create(
|
|||
Username: form.Username,
|
||||
Email: form.Email,
|
||||
Password: form.Password,
|
||||
Reason: text.RemoveHTML(reason),
|
||||
Reason: text.StripHTMLFromText(reason),
|
||||
SignUpIP: form.IP,
|
||||
Locale: form.Locale,
|
||||
AppID: app.ID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue