mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-20 20:07:03 +01:00
Fix WebHookEditor regression from jQuery removal (#29692)
Make these calls optional --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 1dc7f5338623ec97d9ea395380270470847a0066)
This commit is contained in:
parent
38c3cc4eb7
commit
249e26fdae
1 changed files with 10 additions and 7 deletions
|
@ -22,13 +22,16 @@ export function initCompWebHookEditor() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some webhooks (like Gitea) allow to set the request method (GET/POST), and it would toggle the "Content Type" field
|
||||||
|
const httpMethodInput = document.getElementById('http_method');
|
||||||
|
if (httpMethodInput) {
|
||||||
const updateContentType = function () {
|
const updateContentType = function () {
|
||||||
const visible = document.getElementById('http_method').value === 'POST';
|
const visible = httpMethodInput.value === 'POST';
|
||||||
toggleElem(document.getElementById('content_type').parentNode.parentNode, visible);
|
toggleElem(document.getElementById('content_type').closest('.field'), visible);
|
||||||
};
|
};
|
||||||
updateContentType();
|
updateContentType();
|
||||||
|
httpMethodInput.addEventListener('change', updateContentType);
|
||||||
document.getElementById('http_method').addEventListener('change', updateContentType);
|
}
|
||||||
|
|
||||||
// Test delivery
|
// Test delivery
|
||||||
document.getElementById('test-delivery')?.addEventListener('click', async function () {
|
document.getElementById('test-delivery')?.addEventListener('click', async function () {
|
||||||
|
|
Loading…
Reference in a new issue