mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-31 07:08:06 +08:00
Refactor names (#31405)
This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
This commit is contained in:
@ -33,7 +33,7 @@ func UserAssignmentWeb() func(ctx *Context) {
|
||||
// UserIDAssignmentAPI returns a middleware to handle context-user assignment for api routes
|
||||
func UserIDAssignmentAPI() func(ctx *APIContext) {
|
||||
return func(ctx *APIContext) {
|
||||
userID := ctx.ParamsInt64(":user-id")
|
||||
userID := ctx.PathParamInt64(":user-id")
|
||||
|
||||
if ctx.IsSigned && ctx.Doer.ID == userID {
|
||||
ctx.ContextUser = ctx.Doer
|
||||
@ -59,7 +59,7 @@ func UserAssignmentAPI() func(ctx *APIContext) {
|
||||
}
|
||||
|
||||
func userAssignment(ctx *Base, doer *user_model.User, errCb func(int, string, any)) (contextUser *user_model.User) {
|
||||
username := ctx.Params(":username")
|
||||
username := ctx.PathParam(":username")
|
||||
|
||||
if doer != nil && doer.LowerName == strings.ToLower(username) {
|
||||
contextUser = doer
|
||||
|
Reference in New Issue
Block a user