mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-20 09:21:11 +00:00
Sent user activities to distant federated server (#8792)
This PR is part of #4767. It contains * a refactoring of validation error messages * adds the ability to send user-activities to distant federated servers Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8792 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de> Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
This commit is contained in:
parent
6b6fa21b25
commit
c081f20776
22 changed files with 885 additions and 130 deletions
|
@ -45,7 +45,7 @@ func IsValid(v Validateable) (bool, error) {
|
|||
|
||||
func ValidateIDExists(value ap.Item, name string) []string {
|
||||
if value == nil {
|
||||
return []string{fmt.Sprintf("%v should not be nil", name)}
|
||||
return []string{fmt.Sprintf("Field %v must not be nil", name)}
|
||||
}
|
||||
return ValidateNotEmpty(value.GetID().String(), name)
|
||||
}
|
||||
|
@ -76,12 +76,12 @@ func ValidateNotEmpty(value any, name string) []string {
|
|||
if isValid {
|
||||
return []string{}
|
||||
}
|
||||
return []string{fmt.Sprintf("%v should not be empty", name)}
|
||||
return []string{fmt.Sprintf("Value %v should not be empty", name)}
|
||||
}
|
||||
|
||||
func ValidateMaxLen(value string, maxLen int, name string) []string {
|
||||
if utf8.RuneCountInString(value) > maxLen {
|
||||
return []string{fmt.Sprintf("Value %v was longer than %v", name, maxLen)}
|
||||
return []string{fmt.Sprintf("Value %v is longer than expected length %v", name, maxLen)}
|
||||
}
|
||||
return []string{}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue