diff options
author | 2024-01-17 14:54:30 +0000 | |
---|---|---|
committer | 2024-01-17 14:54:30 +0000 | |
commit | 906639ad7eb92e9d631599f78979908930e59c84 (patch) | |
tree | dfef6d0a5ba47c49c214e4537a89dee6ad528df8 /internal/api | |
parent | [bugfix] Better Postgres search case insensitivity (#2526) (diff) | |
download | gotosocial-906639ad7eb92e9d631599f78979908930e59c84.tar.xz |
[chore] update viper version (#2539)
* update viper version
* removes our last uses of the slice package
* fix tests
Diffstat (limited to 'internal/api')
-rw-r--r-- | internal/api/client/accounts/accountupdate.go | 14 | ||||
-rw-r--r-- | internal/api/client/streaming/stream.go | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/internal/api/client/accounts/accountupdate.go b/internal/api/client/accounts/accountupdate.go index ab731bd7e..41f76adf5 100644 --- a/internal/api/client/accounts/accountupdate.go +++ b/internal/api/client/accounts/accountupdate.go @@ -21,6 +21,7 @@ import ( "errors" "fmt" "net/http" + "slices" "strconv" "github.com/gin-gonic/gin" @@ -30,7 +31,6 @@ import ( apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/oauth" - "golang.org/x/exp/slices" ) // AccountUpdateCredentialsPATCHHandler swagger:operation PATCH /api/v1/accounts/update_credentials accountUpdate @@ -283,8 +283,16 @@ func parseFieldsAttributesFromJSON(jsonFieldsAttributes *map[string]apimodel.Upd } // Sort slice by the key each field was submitted with. - slices.SortFunc(fieldsAttributes, func(a, b apimodel.UpdateField) bool { - return a.Key < b.Key + slices.SortFunc(fieldsAttributes, func(a, b apimodel.UpdateField) int { + const k = +1 + switch { + case a.Key > b.Key: + return +k + case a.Key < b.Key: + return -k + default: + return 0 + } }) return &fieldsAttributes, nil diff --git a/internal/api/client/streaming/stream.go b/internal/api/client/streaming/stream.go index 2d1c48341..266b64976 100644 --- a/internal/api/client/streaming/stream.go +++ b/internal/api/client/streaming/stream.go @@ -19,6 +19,7 @@ package streaming import ( "context" + "slices" "time" "codeberg.org/gruf/go-kv" @@ -28,7 +29,6 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/oauth" streampkg "github.com/superseriousbusiness/gotosocial/internal/stream" - "golang.org/x/exp/slices" "github.com/gin-gonic/gin" "github.com/gorilla/websocket" |