fix: api error message (#38031)

Fix various abuses and mistakes
This commit is contained in:
wxiaoguang
2026-06-08 16:58:42 +08:00
committed by GitHub
parent 60f66a9bfd
commit 136f7d18aa
27 changed files with 80 additions and 256 deletions
+2 -3
View File
@@ -4,7 +4,6 @@
package user
import (
"errors"
"net/http"
"strings"
@@ -135,7 +134,7 @@ func GetGPGKey(ctx *context.APIContext) {
// CreateUserGPGKey creates new GPG key to given user by ID.
func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid int64) {
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageGPGKeys) {
ctx.APIErrorNotFound("Not Found", errors.New("gpg keys setting is not allowed to be visited"))
ctx.APIErrorNotFound("gpg keys setting is not allowed to be changed")
return
}
@@ -276,7 +275,7 @@ func DeleteGPGKey(ctx *context.APIContext) {
// "$ref": "#/responses/notFound"
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageGPGKeys) {
ctx.APIErrorNotFound("Not Found", errors.New("gpg keys setting is not allowed to be visited"))
ctx.APIErrorNotFound("gpg keys setting is not allowed to be changed")
return
}