Pārlūkot izejas kodu

db: fix update team panic (#6253)

* db: fix update team panic

* Update CHANGELOG
ᴜɴᴋɴᴡᴏɴ 4 gadi atpakaļ
vecāks
revīzija
a961afe52b
3 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 1 0
      CHANGELOG.md
  2. 1 1
      internal/context/context.go
  3. 1 1
      internal/db/org_team.go

+ 1 - 0
CHANGELOG.md

@@ -56,6 +56,7 @@ All notable changes to Gogs are documented in this file.
 - Private repositories are hidden in the organization's view. [#5869](https://github.com/gogs/gogs/issues/5869)
 - Server error when changing email address in user settings page. [#5899](https://github.com/gogs/gogs/issues/5899)
 - Fall back to use RFC 3339 as time layout when misconfigured. [#6098](https://github.com/gogs/gogs/issues/6098)
+- Unable to update team with server error. [#6185](https://github.com/gogs/gogs/issues/6185)
 - Webhooks are not fired after push when `[service] REQUIRE_SIGNIN_VIEW = true`.
 
 ### Removed

+ 1 - 1
internal/context/context.go

@@ -179,7 +179,7 @@ func (c *Context) NotFound() {
 
 // Error renders the 500 page.
 func (c *Context) Error(err error, msg string) {
-	log.ErrorDepth(5, "%s: %v", msg, err)
+	log.ErrorDepth(4, "%s: %v", msg, err)
 
 	c.Title("status.internal_server_error")
 

+ 1 - 1
internal/db/org_team.go

@@ -348,7 +348,7 @@ func UpdateTeam(t *Team, authChanged bool) (err error) {
 
 	t.LowerName = strings.ToLower(t.Name)
 	existingTeam := new(Team)
-	has, err := x.Where("org_id=?", t.OrgID).And("lower_name=?", t.LowerName).And("id!=?", t.ID).Get(&existingTeam)
+	has, err := x.Where("org_id=?", t.OrgID).And("lower_name=?", t.LowerName).And("id!=?", t.ID).Get(existingTeam)
 	if err != nil {
 		return err
 	} else if has {