Skip to content

Commit

Permalink
fix(core): trim spaces in reason field for Mod Log
Browse files Browse the repository at this point in the history
  • Loading branch information
vednoc committed Jul 10, 2021
1 parent 375086a commit 2ba5457
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions handlers/user/ban.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package user
import (
"log"
"strconv"
"strings"

"github.com/gofiber/fiber/v2"

Expand Down Expand Up @@ -47,7 +48,6 @@ func ConfirmBan(c *fiber.Ctx) error {
u, _ := jwt.User(c)
stringID := c.Params("id")
id, _ := strconv.Atoi(stringID)
reason := c.FormValue("reason")

if !u.IsModOrAdmin() {
return c.Render("err", fiber.Map{
Expand Down Expand Up @@ -77,9 +77,9 @@ func ConfirmBan(c *fiber.Ctx) error {
logEntry := models.Log{
UserID: u.ID,
Username: u.Username,
Reason: reason,
Kind: models.LogBanUser,
TargetUserName: targetUser.Username,
Reason: strings.TrimSpace(c.FormValue("reason")),
}

// Add banned user log entry.
Expand Down

0 comments on commit 2ba5457

Please sign in to comment.