Re-enable cancel on exiting edit_link_save()#2065
Merged
ozh merged 1 commit intoYOURLS:masterfrom Mar 21, 2016
Merged
Conversation
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()
Member
|
🍕 ! |
Contributor
Author
|
😋 |
tomtenuta
pushed a commit
to tomtenuta/YOURLS
that referenced
this pull request
Nov 4, 2025
Re-enable cancel on exiting edit_link_save()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 idedit-close-y...), but leaves the element disabled. This gets evident if and only if the ajax call (action=edit_save) returns with astatusoffail, 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 ofstatus).