-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-73885] Remove inline onclick
handler from script removal form
#120
Conversation
e.preventDefault(); | ||
} | ||
})); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content of the script before the change for easier visual comparison:
function confirmDelete(element) {
var name = element.getAttribute('data-name');
if (confirm("Sure you want to delete ["+name+"]?")) {
return true;
}else{
return false;
}
}
removeScriptButtons.forEach(button => button.addEventListener("click", (e) => { | ||
const name = e.currentTarget.getAttribute('data-name'); | ||
if (!confirm("Sure you want to delete [" + name + "]?")) { | ||
e.preventDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have to do anything if confirm
is true, just let the form get submitted. If it was cancelled we prevent the form submission. So I thought reverting the if
makes sense here.
src/main/resources/org/jenkinsci/plugins/scriptler/ScriptlerManagement/confirm-remove.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
ATH passed: jenkinsci/acceptance-test-harness#1778 |
https://issues.jenkins.io/browse/JENKINS-73885
Testing done
I went to the Scriptler management screen as an admin user, added new script, then removed it. CSP plugin is installed in my Jenkins instance, and it registered multiple CSP violations before the change. After the change the list is clear.
https://www.loom.com/share/690a3867e06a42e7ba160f31701eb38c?sid=2a371698-8b64-4aa2-ad62-83c1d0e9e2ad
https://www.loom.com/share/0336da4251ad4419986f6559771494b7?sid=761d9c6b-69a5-490d-b401-d057646e63cb
Submitter checklist
Link to relevant pull requests, esp. upstream and downstream changes