Fix #4241: Approving a post then editing tags returns 404.

This is what happens:

* The post is approved.
* The approval action reloads the page by calling `location.reload()`.
* After the page is reloaded, the value of the hidden `_method` param in
  the post edit form is mysteriously overwritten with the value of the
  authenticity_token param from the previous page load.
* The post edit form is submitted, but the _method param isn't set to
  `patch`, so the form submission is treated as a POST request instead of
  a PUT request.
* The POST endpoint doesn't exist, so the form submission returns 404.

The cause appears to be buggy form autofill in Firefox 72. This only
happens in Firefox 72, not in Firefox 68 or in other browsers.
This commit is contained in:
evazion
2020-01-10 12:35:41 -06:00
parent 3ca4f4f32c
commit cde8ee64e1

View File

@@ -6,7 +6,7 @@
<%= render "sources/info" %>
<%= simple_form_for(post, html: { id: "form" }) do |f| %>
<%= simple_form_for(post, html: { id: "form", autocomplete: "off" }) do |f| %>
<%= hidden_field_tag :tags_query, params[:q] %>
<%= hidden_field_tag :pool_id, params[:pool_id] %>
<%= hidden_field_tag :favgroup_id, params[:favgroup_id] %>