mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 09:12:26 -05:00
[chore] Increase default max image description to 1500 chars, collapse cw char count into status (#2682)
* [chore] Make default max image description 1500 chars, collapse cw char count into status * oops * tests
This commit is contained in:
parent
1d51e3c8d6
commit
4b0eefbcc9
10 changed files with 19 additions and 65 deletions
|
|
@ -137,15 +137,11 @@ func validateNormalizeCreateStatus(form *apimodel.AdvancedStatusCreateForm) erro
|
|||
}
|
||||
|
||||
maxChars := config.GetStatusesMaxChars()
|
||||
maxMediaFiles := config.GetStatusesMediaMaxFiles()
|
||||
maxCwChars := config.GetStatusesCWMaxChars()
|
||||
|
||||
if form.Status != "" {
|
||||
if length := len([]rune(form.Status)); length > maxChars {
|
||||
return fmt.Errorf("status too long, %d characters provided but limit is %d", length, maxChars)
|
||||
}
|
||||
if length := len([]rune(form.Status)) + len([]rune(form.SpoilerText)); length > maxChars {
|
||||
return fmt.Errorf("status too long, %d characters provided (including spoiler/content warning) but limit is %d", length, maxChars)
|
||||
}
|
||||
|
||||
maxMediaFiles := config.GetStatusesMediaMaxFiles()
|
||||
if len(form.MediaIDs) > maxMediaFiles {
|
||||
return fmt.Errorf("too many media files attached to status, %d attached but limit is %d", len(form.MediaIDs), maxMediaFiles)
|
||||
}
|
||||
|
|
@ -156,12 +152,6 @@ func validateNormalizeCreateStatus(form *apimodel.AdvancedStatusCreateForm) erro
|
|||
}
|
||||
}
|
||||
|
||||
if form.SpoilerText != "" {
|
||||
if length := len([]rune(form.SpoilerText)); length > maxCwChars {
|
||||
return fmt.Errorf("content-warning/spoilertext too long, %d characters provided but limit is %d", length, maxCwChars)
|
||||
}
|
||||
}
|
||||
|
||||
if form.Language != "" {
|
||||
language, err := validate.Language(form.Language)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue