satellite/admin: allow more than just "paid" invoice status during user deletion

Currently we do not allow anything other than the "paid" status for invoices when
trying to delete a user. However there can be a couple of other states that are
still fine to accept during deletion of a user. This change reverses the order to
check for the status that we do not want to allow.

Change-Id: I78d85af6438015c55100fa201ccffc731c91de1c
This commit is contained in:
Stefan Benten 2020-12-23 16:40:44 +01:00
parent 7aea6feee3
commit ad58459198

View File

@ -341,7 +341,7 @@ func (server *Server) deleteUser(w http.ResponseWriter, r *http.Request) {
}
if len(invoices) > 0 {
for _, invoice := range invoices {
if invoice.Status != "paid" {
if invoice.Status == "draft" || invoice.Status == "open" {
httpJSONError(w, "user has unpaid/pending invoices",
"", http.StatusConflict)
return