aboutsummaryrefslogtreecommitdiff
path: root/models/org_team.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-08 18:13:46 -0500
committerUnknwon <u@gogs.io>2017-02-08 18:13:46 -0500
commita2dd9ec2e1d0d613f3af9f9722e433eaa6c86a5f (patch)
tree2ab0d09f27fdb074eeff062864c0d9b43a09e0cf /models/org_team.go
parent591c333dcdf93004d883277c01e8819b33065456 (diff)
models/org_team: panic when team num_repos is negative (#3671)
Diffstat (limited to 'models/org_team.go')
-rw-r--r--models/org_team.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/org_team.go b/models/org_team.go
index b119dfbb..0d132b20 100644
--- a/models/org_team.go
+++ b/models/org_team.go
@@ -26,6 +26,16 @@ type Team struct {
NumMembers int
}
+func (t *Team) AfterSet(colName string, _ xorm.Cell) {
+ switch colName {
+ case "num_repos":
+ // LEGACY [0.11]: this is backward compatibility bug fix for https://github.com/gogits/gogs/issues/3671
+ if t.NumRepos < 0 {
+ t.NumRepos = 0
+ }
+ }
+}
+
// IsOwnerTeam returns true if team is owner team.
func (t *Team) IsOwnerTeam() bool {
return t.Name == OWNER_TEAM