Преглед на файлове

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

JustSong преди 2 години
родител
ревизия
241ade2fae
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  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 {