From f5c2ad7fd86a5801aad4c2fb58104d212e0ae6a1 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Mon, 1 Jan 2018 11:58:43 +0000 Subject: Merge branch 'sh-fix-spam-update-404' into 'master' Fix 404 error after a user edits an issue description and solves the reCAPTCHA Closes #41445 See merge request gitlab-org/gitlab-ce!16167 (cherry picked from commit ac35636f4ad92a2f3080af556ad8cfadf73ce977) b8f5a7d5 Fix 404 error after a user edits an issue description and solves the reCAPTCHA --- app/views/shared/_recaptcha_form.html.haml | 3 ++- changelogs/unreleased/sh-fix-spam-update-404.yml | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/sh-fix-spam-update-404.yml diff --git a/app/views/shared/_recaptcha_form.html.haml b/app/views/shared/_recaptcha_form.html.haml index 0e816870f15..93a4301f366 100644 --- a/app/views/shared/_recaptcha_form.html.haml +++ b/app/views/shared/_recaptcha_form.html.haml @@ -1,9 +1,10 @@ - resource_name = spammable.class.model_name.singular - humanized_resource_name = spammable.class.model_name.human.downcase - script = local_assigns.fetch(:script, true) +- method = params[:action] == 'create' ? :post : :put - has_submit = local_assigns.fetch(:has_submit, true) -= form_for resource_name, method: :post, html: { class: 'recaptcha-form js-recaptcha-form' } do |f| += form_for resource_name, method: method, html: { class: 'recaptcha-form js-recaptcha-form' } do |f| .recaptcha - params[resource_name].each do |field, value| = hidden_field(resource_name, field, value: value) diff --git a/changelogs/unreleased/sh-fix-spam-update-404.yml b/changelogs/unreleased/sh-fix-spam-update-404.yml new file mode 100644 index 00000000000..13daec35ecf --- /dev/null +++ b/changelogs/unreleased/sh-fix-spam-update-404.yml @@ -0,0 +1,5 @@ +--- +title: Fix 404 errors after a user edits an issue description and solves the reCAPTCHA +merge_request: +author: +type: fixed -- cgit v1.2.1