Skip to content

Commit

Permalink
Fix duplicate project board when hitting enter key (go-gitea#27746)
Browse files Browse the repository at this point in the history
When hitting the `enter` key to create a new project column, the request
is sent twice because the `submit` event and `key up` event are both
triggered.
Probably a better solution is to rewrite these parts of the code to
avoid using native jQuery but reuse the `form-fetch-action` class. But
it's beyond my ability.
  • Loading branch information
lng2020 authored and fuxiaohei committed Jan 17, 2024
1 parent 150196c commit 33a0732
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions web_src/js/features/repo-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,6 @@ export function initRepoProject() {
const url = $(this).data('url');
createNewColumn(url, columnTitle, projectColorInput);
});

$('.new-project-column').on('input keyup', (e) => {
const columnTitle = $('#new_project_column');
const projectColorInput = $('#new_project_column_color_picker');
if (!columnTitle.val()) {
$('#new_project_column_submit').addClass('disabled');
return;
}
$('#new_project_column_submit').removeClass('disabled');
if (e.key === 'Enter') {
const url = $(this).data('url');
createNewColumn(url, columnTitle, projectColorInput);
}
});
}

function setLabelColor(label, color) {
Expand Down

0 comments on commit 33a0732

Please sign in to comment.