From af866b3e653bb378533ad741d720757b01657f1a Mon Sep 17 00:00:00 2001 From: "BestNa.me Labs" Date: Tue, 22 Mar 2016 20:09:38 +0100 Subject: [PATCH] Re-enable actions only if edit-save succeeded Fixes a flaw in `edit_link_save()` in insert.js: On exit, `edit_link_save()` re-enables all buttons of the action column, regardless of the value of `status` as returned by the ajax call (`action=edit_save`), i.e. also if the `status` is `fail` which means that the edit row remains visible. Because of that, it is then possible to open another edit row for the same keyword/long URL row. It is even possible to repeat this, introducing an arbitrary number of open edit rows with the same content. --- js/insert.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/insert.js b/js/insert.js index 0fe2a2e..7c50d7b 100644 --- a/js/insert.js +++ b/js/insert.js @@ -164,7 +164,9 @@ function edit_link_save(id) { feedback(data.message, data.status); end_loading("#edit-close-" + id); end_disable("#edit-close-" + id); - end_disable("#actions-" + id + ' .button'); + if(data.status == 'success') { + end_disable("#actions-" + id + ' .button'); + } } ); } -- 2.42.0