Explorar el Código

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

JustSong hace 2 años
padre
commit
241ade2fae
Se han modificado 1 ficheros con 1 adiciones y 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 {