mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] Reorder web view logic, other small fixes (#1954)
This commit is contained in:
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user