Defect #17517

Attempting to Add a Related Issue Multiple Times Sequentially Causes 500

Added by Zach Auclair over 4 years ago. Updated 4 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:4.0.0
Resolution:Fixed Affected version:2.5.1

Description

When pressing "Add" after typing a related issue, the form ajax submits but does not prevent further ajax submits while the request is being processed.

As a result of this, clicking "add" multiple times quickly will cause sequential requests to link an issue (after the first) to fail; along with this, the results of the last post are displayed (meaning the first successful add of a related issue may be hidden).

proposed patch:

diff --git a/app/views/issue_relations/_form.html.erb b/app/views/issue_relations/_form.html.erb
index 29b7f0f..ff80e47 100644
--- a/app/views/issue_relations/_form.html.erb
+++ b/app/views/issue_relations/_form.html.erb
@@ -5,7 +5,7 @@
 <span id="predecessor_fields" style="display:none;">
 <%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
 </span>
-<%= submit_tag l(:button_add) %>
+<%= submit_tag l(:button_add), :disable_with => l(:button_add) %>
 <%= link_to_function l(:button_cancel), '$("#new-relation-form").hide();'%>
 </p>


Related issues

Related to Redmine - Feature #23630: Migrate to Rails 5.2 Closed

History

#1 Updated by Toshi MARUYAMA about 4 years ago

  • Target version set to 2.5.3

#2 Updated by Toshi MARUYAMA about 4 years ago

  • Target version changed from 2.5.3 to 2.6.0

#3 Updated by Toshi MARUYAMA about 4 years ago

https://github.com/plataformatec/devise/issues/2343#issuecomment-15334387

DEPRECATION WARNING: :disable_with option is deprecated and will be removed from Rails 4.1. Use 'data: { disable_with: 'Text' }' instead.

#4 Updated by Jean-Philippe Lang about 4 years ago

  • Status changed from New to Needs feedback
  • Assignee set to Jean-Philippe Lang
The proposed fix has a side effect with Firefox (tested with 24 ESR):
  1. go to an issue, add a relation
  2. hit F5
  3. click on the 'Add' link to add another relation => the 'Add' button is disabled

Problem doesn't occur if step 2 is omitted.

BTW, I don't get 500 errors when hitting the button multiple times. I only get a proper validation error message. Can you post your 500 error stack trace ?

#5 Updated by Jean-Philippe Lang about 4 years ago

  • Target version changed from 2.6.0 to Candidate for next minor release

#6 Updated by Marius BALTEANU 7 months ago

It seems that the data-disable-with attribute is enabled by default in Rails 5. There are some examples here.

Also, I tested this issue on the current trunk and works as expected in the major browsers (Safari, Chrome and Firefox) on OS X. I propose to mark this ticket as fixed by #23630.

#7 Updated by Marius BALTEANU 7 months ago

#8 Updated by Marius BALTEANU 5 months ago

  • Assignee deleted (Jean-Philippe Lang)
  • Target version changed from Candidate for next minor release to 4.0.0

Considering that the issue seems to be fixed in version 4.0.0 by the migration to Rails 5.1, I would like a second opinion before closing it.

#9 Updated by Jean-Philippe Lang 4 months ago

  • Status changed from Needs feedback to Closed
  • Resolution set to Fixed

Works for me

Also available in: Atom PDF