mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:15:43 +01:00
Merge pull request '[BUG] Fix Ctrl+Enter on submitting review comment' (#2370) from gusted/forgejo-review-ctrlenter into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2370 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
bd2ba9f6e5
1 changed files with 5 additions and 2 deletions
|
@ -57,8 +57,10 @@ function initRepoDiffConversationForm() {
|
|||
$form.addClass('is-loading');
|
||||
const formData = new FormData($form[0]);
|
||||
|
||||
// if the form is submitted by a button, append the button's name and value to the form data
|
||||
const submitter = submitEventSubmitter(e.originalEvent);
|
||||
// If the form is submitted by a button, append the button's name and value to the form data.
|
||||
// originalEvent can be undefined, such as an event that's caused by Ctrl+Enter, in that case
|
||||
// sent the event itself.
|
||||
const submitter = submitEventSubmitter(e.originalEvent ?? e);
|
||||
const isSubmittedByButton = (submitter?.nodeName === 'BUTTON') || (submitter?.nodeName === 'INPUT' && submitter.type === 'submit');
|
||||
if (isSubmittedByButton && submitter.name) {
|
||||
formData.append(submitter.name, submitter.value);
|
||||
|
@ -76,6 +78,7 @@ function initRepoDiffConversationForm() {
|
|||
$newConversationHolder.find('.dropdown').dropdown();
|
||||
initCompReactionSelector($newConversationHolder);
|
||||
} catch { // here the caught error might be a jQuery AJAX error (thrown by await $.post), which is not good to use for error message handling
|
||||
console.error('error when submitting conversation', e);
|
||||
showErrorToast(i18n.network_error);
|
||||
} finally {
|
||||
$form.removeClass('is-loading');
|
||||
|
|
Loading…
Reference in a new issue