{"thread":{"id":"49572","subject":"Case when I can not unstage the hunk","startedAt":"2018-10-15T12:33:45Z","lastAt":"2018-10-15T12:33:45Z","messageCount":1,"participants":["KES"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"360518","messageId":"9994851539606820@myt5-f9d71769b752.qloud-c.yandex.net","threadId":"49572","inReplyTo":null,"subject":"Case when I can not unstage the hunk","fromName":"KES","fromEmail":"kes-kes@yandex.ru","sentAt":"2018-10-15T12:33:40Z","receivedAt":"2018-10-15T12:33:45Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"Hi. \nHere is log:\n\ngit reset HEAD -p /home/kes/s/public/v2/js/contact_us.js\ndiff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js\nindex e05be6d0..d429d291 100644\n--- a/public/v2/js/contact_us.js\n+++ b/public/v2/js/contact_us.js\n@@ -1,7 +1,19 @@\n+\n+\n+function captchaProcess( form ) {\n+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )\n+        .attr( 'id' ).match( /\\d+$/ );\n+      if( id ){ id =  id[0] } else { id = 0 }\n+      grecaptcha.reset( Number( id ) );\n+      grecaptcha.execute( Number( id ) );\n+      // When .execute is done this will trigger callback\n+      // which is specified on g-recaptcha div element via data-callback attr\n+}\n+\n+\n // FORM VALIDATION\n-var validator;\n $(function(){\n-  validator =  $('#contact_us-form').validate({\n+  $('#contact_us-form').validate({\n     rules: {\n       name: {\n         required: true,\nUnstage this hunk [y,n,q,a,d,j,J,g,/,s,e,?]? s\nSplit into 3 hunks.\n@@ -1 +1,14 @@\n+\n+\n+function captchaProcess( form ) {\n+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )\n+        .attr( 'id' ).match( /\\d+$/ );\n+      if( id ){ id =  id[0] } else { id = 0 }\n+      grecaptcha.reset( Number( id ) );\n+      grecaptcha.execute( Number( id ) );\n+      // When .execute is done this will trigger callback\n+      // which is specified on g-recaptcha div element via data-callback attr\n+}\n+\n+\n // FORM VALIDATION\nUnstage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n\n@@ -1,3 +14,2 @@\n // FORM VALIDATION\n-var validator;\n $(function(){\nUnstage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]? y\n@@ -3,5 +15,5 @@\n $(function(){\n-  validator =  $('#contact_us-form').validate({\n+  $('#contact_us-form').validate({\n     rules: {\n       name: {\n         required: true,\nUnstage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]? y\n@@ -47,12 +59,7 @@ $(function(){\n       $(element).removeClass(\"error_inp\");\n     },\n     submitHandler: function(form) {\n-      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )\n-        .attr( 'id' ).match( /\\d+$/ );\n-      if( id ){ id =  id[0] } else { id = 0 }\n-      grecaptcha.execute( Number( id ) );\n-      // When .execute is done this will trigger callback\n-      // which is specified on g-recaptcha div element via data-callback attr\n+      captchaProcess( form );\n     }\n   });\n });\nUnstage this hunk [y,n,q,a,d,K,g,/,e,?]? n\nerror: patch failed: public/v2/js/contact_us.js:1\nerror: public/v2/js/contact_us.js: patch does not apply\ndiff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js\nindex e05be6d0..d429d291 100644\n--- a/public/v2/js/contact_us.js\n+++ b/public/v2/js/contact_us.js\n@@ -1,7 +1,6 @@\n // FORM VALIDATION\n-var validator;\n $(function(){\n-  validator =  $('#contact_us-form').validate({\n+  $('#contact_us-form').validate({\n     rules: {\n       name: {\n         required: true,\n\n\n\nDETAILS:\n\ngit diff -b -w --ignore-blank-lines /home/kes/s/public/v2/js/contact_us.js\ndiff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js\nindex d429d291..bd1f4ddd 100644\n--- a/public/v2/js/contact_us.js\n+++ b/public/v2/js/contact_us.js\n@@ -1,10 +1,24 @@\n \n+function show_validator_errors( xhr, validator ) {\n+  if( xhr.status == 404 ) { return }\n+\n+  var res =  xhr.responseJSON;\n+  // TODO: Display responseText if there is no responseJSON\n+  if( !res ) { return };\n+\n+  var errors =  {};\n+  // convert server response into validator format\n+  for( var error in res.error.info ) {\n+    errors[error] =  res.error.info[ error ][ 1 ] || 'Error';\n+  }\n+  validator.showErrors( errors );\n+}\n+\n \n function captchaProcess( form ) {\n       var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )\n         .attr( 'id' ).match( /\\d+$/ );\n       if( id ){ id =  id[0] } else { id = 0 }\n-      grecaptcha.reset( Number( id ) );\n       grecaptcha.execute( Number( id ) );\n       // When .execute is done this will trigger callback\n       // which is specified on g-recaptcha div element via data-callback attr\n\n\n\n\n\n\n\n\ngit diff -b -w --ignore-blank-lines --staged /home/kes/s/public/v2/js/contact_us.js\ndiff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js\nindex e05be6d0..d429d291 100644\n--- a/public/v2/js/contact_us.js\n+++ b/public/v2/js/contact_us.js\n@@ -1,7 +1,19 @@\n+\n+\n+function captchaProcess( form ) {\n+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )\n+        .attr( 'id' ).match( /\\d+$/ );\n+      if( id ){ id =  id[0] } else { id = 0 }\n+      grecaptcha.reset( Number( id ) );\n+      grecaptcha.execute( Number( id ) );\n+      // When .execute is done this will trigger callback\n+      // which is specified on g-recaptcha div element via data-callback attr\n+}\n+\n+\n // FORM VALIDATION\n-var validator;\n $(function(){\n-  validator =  $('#contact_us-form').validate({\n+  $('#contact_us-form').validate({\n     rules: {\n       name: {\n         required: true,\n\n\n\n\n"}]}