Przeglądaj źródła

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

JustSong 2 lat temu
rodzic
commit
241ade2fae
1 zmienionych plików z 1 dodań i 1 usunięć
  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 {
 		if quota > 0 {
 			err = IncreaseUserQuota(userId, quota)
 			err = IncreaseUserQuota(userId, quota)
 		} else {
 		} else {
-			err = DecreaseUserQuota(userId, quota)
+			err = DecreaseUserQuota(userId, -quota)
 		}
 		}
 	}
 	}
 	if err != nil {
 	if err != nil {