Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -53,7 +53,8 @@ |
54 | 54 | limit: 25, |
55 | 55 | continue: null, |
56 | 56 | continueId: null, // Sort of a tie-breaker for continue values. |
57 | | - disabled: false // Prevent (or at least limit) a flood of ajax requests. |
| 57 | + disabled: false, // Prevent (at least limit) a flood of ajax requests. |
| 58 | + allowMultiple: false |
58 | 59 | }; |
59 | 60 | |
60 | 61 | /** |
— | — | @@ -175,11 +176,17 @@ |
176 | 177 | if ( activity[value] ) { |
177 | 178 | $.articleFeedbackv5special.flagFeedback( id, value, -1 ); |
178 | 179 | } else if ( 'helpful' == value && activity.unhelpful ) { |
| 180 | + // Allow multiple simultaneous ajax requests in this case. |
| 181 | + $.articleFeedbackv5special.listControls.allowMultiple = true; |
179 | 182 | $.articleFeedbackv5special.flagFeedback( id, 'unhelpful', -1 ); |
180 | 183 | $.articleFeedbackv5special.flagFeedback( id, 'helpful', 1 ); |
| 184 | + $.articleFeedbackv5special.listControls.allowMultiple = false; |
181 | 185 | } else if ( 'unhelpful' == value && activity.helpful ) { |
| 186 | + // Allow multiple simultaneous ajax requests in this case. |
| 187 | + $.articleFeedbackv5special.listControls.allowMultiple = true; |
182 | 188 | $.articleFeedbackv5special.flagFeedback( id, 'helpful', -1 ); |
183 | 189 | $.articleFeedbackv5special.flagFeedback( id, 'unhelpful', 1 ); |
| 190 | + $.articleFeedbackv5special.listControls.allowMultiple = false; |
184 | 191 | } else { |
185 | 192 | $.articleFeedbackv5special.flagFeedback( id, value, 1 ); |
186 | 193 | } |
— | — | @@ -473,10 +480,16 @@ |
474 | 481 | return false; |
475 | 482 | } |
476 | 483 | |
477 | | - // Put a lock on ajax requests to prevent another one from going |
478 | | - // through while this is still running. Prevents manic link-clicking |
479 | | - // messing up the counts, and generally seems like a good idea. |
480 | | - $.articleFeedbackv5special.listControls.disabled = true; |
| 484 | + // This was causing problems with eg 'clicking helpful when the cookie |
| 485 | + // already says unhelpful', which is a case where two ajax requests |
| 486 | + // is perfectly legitimate. |
| 487 | + // Check another global variable to not disable ajax in that case. |
| 488 | + if( !$.articleFeedbackv5special.listControls.allowMultiple ) { |
| 489 | + // Put a lock on ajax requests to prevent another one from going |
| 490 | + // through while this is still running. Prevents manic link-clicking |
| 491 | + // messing up the counts, and generally seems like a good idea. |
| 492 | + $.articleFeedbackv5special.listControls.disabled = true; |
| 493 | + } |
481 | 494 | |
482 | 495 | $.ajax( { |
483 | 496 | 'url' : $.articleFeedbackv5special.apiUrl, |