summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-12-30 06:00:18 -0800
committerStan Hu <stanhu@gmail.com>2017-12-30 06:14:23 -0800
commitb8f5a7d5e904ca41a9f7cf97d3eb0f9fa0249240 (patch)
tree1fbe031874a6742e29cd960387e6e9332bf6d011
parentff077cf7dc5cfd7c6c6206d801ea3f326f7af1aa (diff)
downloadgitlab-ce-sh-fix-spam-update-404.tar.gz
Fix 404 error after a user edits an issue description and solves the reCAPTCHAsh-fix-spam-update-404
When editing an issue, use the PUT method instead of POST to avoid a 404 after solving the reCAPTCHA. Closes #41445
-rw-r--r--app/views/shared/_recaptcha_form.html.haml3
-rw-r--r--changelogs/unreleased/sh-fix-spam-update-404.yml5
2 files changed, 7 insertions, 1 deletions
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