mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature/frontend] Reports frontend v2 (#3022)
* use apiutil + paging in admin processor+handlers * we're making it happen * fix little whoopsie * styling for report list * don't youuuu forget about meee don't don't don't don't * last bits * sanitize content before showing in report statuses * update report docs
This commit is contained in:
@@ -34,13 +34,16 @@ const (
|
||||
|
||||
/* Common keys */
|
||||
|
||||
IDKey = "id"
|
||||
LimitKey = "limit"
|
||||
LocalKey = "local"
|
||||
MaxIDKey = "max_id"
|
||||
SinceIDKey = "since_id"
|
||||
MinIDKey = "min_id"
|
||||
UsernameKey = "username"
|
||||
IDKey = "id"
|
||||
LimitKey = "limit"
|
||||
LocalKey = "local"
|
||||
MaxIDKey = "max_id"
|
||||
SinceIDKey = "since_id"
|
||||
MinIDKey = "min_id"
|
||||
UsernameKey = "username"
|
||||
AccountIDKey = "account_id"
|
||||
TargetAccountIDKey = "target_account_id"
|
||||
ResolvedKey = "resolved"
|
||||
|
||||
/* AP endpoint keys */
|
||||
|
||||
@@ -55,7 +58,6 @@ const (
|
||||
SearchQueryKey = "q"
|
||||
SearchResolveKey = "resolve"
|
||||
SearchTypeKey = "type"
|
||||
SearchAccountIDKey = "account_id"
|
||||
|
||||
/* Tag keys */
|
||||
|
||||
@@ -132,6 +134,10 @@ func ParseLocal(value string, defaultValue bool) (bool, gtserror.WithCode) {
|
||||
return parseBool(value, defaultValue, LocalKey)
|
||||
}
|
||||
|
||||
func ParseResolved(value string, defaultValue *bool) (*bool, gtserror.WithCode) {
|
||||
return parseBoolPtr(value, defaultValue, ResolvedKey)
|
||||
}
|
||||
|
||||
func ParseSearchExcludeUnreviewed(value string, defaultValue bool) (bool, gtserror.WithCode) {
|
||||
return parseBool(value, defaultValue, SearchExcludeUnreviewedKey)
|
||||
}
|
||||
@@ -289,6 +295,19 @@ func parseBool(value string, defaultValue bool, key string) (bool, gtserror.With
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func parseBoolPtr(value string, defaultValue *bool, key string) (*bool, gtserror.WithCode) {
|
||||
if value == "" {
|
||||
return defaultValue, nil
|
||||
}
|
||||
|
||||
i, err := strconv.ParseBool(value)
|
||||
if err != nil {
|
||||
return defaultValue, parseError(key, value, defaultValue, err)
|
||||
}
|
||||
|
||||
return &i, nil
|
||||
}
|
||||
|
||||
func parseInt(value string, defaultValue int, max int, min int, key string) (int, gtserror.WithCode) {
|
||||
if value == "" {
|
||||
return defaultValue, nil
|
||||
|
Reference in New Issue
Block a user