File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,10 @@ function initRepoDiffConversationForm() {
5757 $form . addClass ( 'is-loading' ) ;
5858 const formData = new FormData ( $form [ 0 ] ) ;
5959
60- // if the form is submitted by a button, append the button's name and value to the form data
61- const submitter = submitEventSubmitter ( e . originalEvent ) ;
60+ // If the form is submitted by a button, append the button's name and value to the form data.
61+ // originalEvent can be undefined, such as an event that's caused by Ctrl+Enter, in that case
62+ // sent the event itself.
63+ const submitter = submitEventSubmitter ( e . originalEvent ?? e ) ;
6264 const isSubmittedByButton = ( submitter ?. nodeName === 'BUTTON' ) || ( submitter ?. nodeName === 'INPUT' && submitter . type === 'submit' ) ;
6365 if ( isSubmittedByButton && submitter . name ) {
6466 formData . append ( submitter . name , submitter . value ) ;
@@ -76,6 +78,7 @@ function initRepoDiffConversationForm() {
7678 $newConversationHolder . find ( '.dropdown' ) . dropdown ( ) ;
7779 initCompReactionSelector ( $newConversationHolder ) ;
7880 } 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
81+ console . error ( 'error when submitting conversation' , e ) ;
7982 showErrorToast ( i18n . network_error ) ;
8083 } finally {
8184 $form . removeClass ( 'is-loading' ) ;
You can’t perform that action at this time.
0 commit comments