Skip to content

Re-enable cancel on exiting edit_link_save()#2065

Merged
ozh merged 1 commit intoYOURLS:masterfrom
BstName:fix
Mar 21, 2016
Merged

Re-enable cancel on exiting edit_link_save()#2065
ozh merged 1 commit intoYOURLS:masterfrom
BstName:fix

Conversation

@BstName
Copy link
Copy Markdown
Contributor

@BstName BstName commented Mar 21, 2016

Fixes a flaw in edit_link_save() in insert.js:

On exit, edit_link_save() correctly ends the loading state of the cancel button (i.e. the element with id edit-close-y...), but leaves the element disabled. This gets evident if and only if the ajax call (action=edit_save) returns with a status of fail, since only then the edit row with the disabled cancel button will not be faded out.

The flaw exists at least since v1.7.0.

To reproduce the problem on e.g. a fresh install, click the edit button of an arbitrary row of the table in the admin panel. Then, without editing anything(!), click the save button. You will get the correct notification 'Error updating {trimmed longurl} Short URL: {untrimmed keyword}' because there is nothing (i.e. no change) to save yet. The edit row remains visible. Now click the cancel button: Nada, the edit row can not be cancelled and remains visible.

Fix: Added a line calling end_disable('#edit-close-' + id) before exiting the function (regardless of the value of status).

Fixes a flaw in `edit_link_save()` in insert.js:

On exit, `edit_link_save()` correctly ends the loading state of the cancel button (i.e. the element with id `edit-close-y...`), but leaves the element disabled. This gets evident if and only if the ajax call (`action=edit_save`) returns with a `status` of `fail`, since only then the edit row with the disabled cancel button will not be faded out.
ozh added a commit that referenced this pull request Mar 21, 2016
Re-enable cancel on exiting edit_link_save()
@ozh ozh merged commit 2f9e0c1 into YOURLS:master Mar 21, 2016
@ozh
Copy link
Copy Markdown
Member

ozh commented Mar 21, 2016

🍕 !

@BstName
Copy link
Copy Markdown
Contributor Author

BstName commented Mar 22, 2016

😋

@BstName BstName deleted the fix branch March 22, 2016 08:43
tomtenuta pushed a commit to tomtenuta/YOURLS that referenced this pull request Nov 4, 2025
Re-enable cancel on exiting edit_link_save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants