[MODERATION] User blocking (squash) RemoveUsernameParameterSuffix

This commit is contained in:
Earl Warren 2024-02-05 17:05:31 +01:00
parent 8d3fab8944
commit ee5a3a6401
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -11,7 +11,6 @@ import (
"code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/db"
user_model "code.gitea.io/gitea/models/user" user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/routers/utils"
user_service "code.gitea.io/gitea/services/user" user_service "code.gitea.io/gitea/services/user"
) )
@ -35,7 +34,7 @@ func BlockedUsers(ctx *context.Context) {
// BlockedUsersBlock blocks a particular user from the organization. // BlockedUsersBlock blocks a particular user from the organization.
func BlockedUsersBlock(ctx *context.Context) { func BlockedUsersBlock(ctx *context.Context) {
uname := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.FormString("uname"))) uname := strings.ToLower(ctx.FormString("uname"))
u, err := user_model.GetUserByName(ctx, uname) u, err := user_model.GetUserByName(ctx, uname)
if err != nil { if err != nil {
ctx.ServerError("GetUserByName", err) ctx.ServerError("GetUserByName", err)