Fix double-click when deleting a bill (#349) (#372)

When double-clicking on the delete button, the first click actually
deletes the bill, and the second click does the same action again. But
as the bill is already deleted, it displays a 404 page which can be
misleading.

This fix makes the app trigger a redirect when the bill seem to doesn't
exist, fixing this strange behaviour.
This commit is contained in:
Alexis Metaireau 2018-09-03 20:53:37 +02:00 committed by GitHub
parent 22f8d552c3
commit 24e0d8348f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -514,7 +514,7 @@ def delete_bill(bill_id):
# fixme: everyone is able to delete a bill
bill = Bill.query.get(g.project, bill_id)
if not bill:
raise NotFound()
return redirect(url_for('.list_bills'))
db.session.delete(bill)
db.session.commit()