Explorar o código

fix: delete a token with a negative quota will now update the account's quota correctly (close #51)

JustSong %!s(int64=2) %!d(string=hai) anos
pai
achega
241ade2fae
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      model/token.go

+ 1 - 1
model/token.go

@@ -121,7 +121,7 @@ func DeleteTokenById(id int, userId int) (err error) {
 		if quota > 0 {
 			err = IncreaseUserQuota(userId, quota)
 		} else {
-			err = DecreaseUserQuota(userId, quota)
+			err = DecreaseUserQuota(userId, -quota)
 		}
 	}
 	if err != nil {