mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-14 07:47:29 -06:00
[bugfix] Reorder web view logic, other small fixes (#1954)
This commit is contained in:
parent
9ff4c20374
commit
ac564c1862
9 changed files with 375 additions and 182 deletions
|
|
@ -43,6 +43,11 @@ const (
|
|||
SearchResolveKey = "resolve"
|
||||
SearchTypeKey = "type"
|
||||
|
||||
/* Web endpoint keys */
|
||||
|
||||
WebUsernameKey = "username"
|
||||
WebStatusIDKey = "status"
|
||||
|
||||
/* Domain block keys */
|
||||
|
||||
DomainBlockExportKey = "export"
|
||||
|
|
@ -75,6 +80,14 @@ func ParseLocal(value string, defaultValue bool) (bool, gtserror.WithCode) {
|
|||
return parseBool(value, defaultValue, LocalKey)
|
||||
}
|
||||
|
||||
func ParseMaxID(value string, defaultValue string) string {
|
||||
if value == "" {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func ParseSearchExcludeUnreviewed(value string, defaultValue bool) (bool, gtserror.WithCode) {
|
||||
return parseBool(value, defaultValue, SearchExcludeUnreviewedKey)
|
||||
}
|
||||
|
|
@ -133,6 +146,26 @@ func ParseSearchQuery(value string) (string, gtserror.WithCode) {
|
|||
return value, nil
|
||||
}
|
||||
|
||||
func ParseWebUsername(value string) (string, gtserror.WithCode) {
|
||||
key := WebUsernameKey
|
||||
|
||||
if value == "" {
|
||||
return "", requiredError(key)
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
func ParseWebStatusID(value string) (string, gtserror.WithCode) {
|
||||
key := WebStatusIDKey
|
||||
|
||||
if value == "" {
|
||||
return "", requiredError(key)
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
/*
|
||||
Internal functions
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue