aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/cobrands/fixmystreet/assets.js6
-rw-r--r--web/js/duplicates.js15
2 files changed, 16 insertions, 5 deletions
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index e6202f809..ad14b9390 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -942,10 +942,10 @@ fixmystreet.message_controller = (function() {
}
// This hides the responsibility message, and (unless a
- // stopper message is shown) reenables the report form
+ // stopper message or dupes are shown) reenables the report form
function responsibility_off() {
hide_responsibility_errors();
- if (!document.getElementById(stopperId)) {
+ if (!document.getElementById(stopperId) && !$('#js-duplicate-reports').is(':visible')) {
enable_report_form();
}
}
@@ -1004,7 +1004,7 @@ fixmystreet.message_controller = (function() {
if (!matching.length) {
$id.remove();
- if ( !$('#js-roads-responsibility').is(':visible') ) {
+ if ( !$('#js-roads-responsibility').is(':visible') && !$('#js-duplicate-reports').is(':visible') ) {
enable_report_form();
}
return;
diff --git a/web/js/duplicates.js b/web/js/duplicates.js
index ff1f0bd47..0844cb5f3 100644
--- a/web/js/duplicates.js
+++ b/web/js/duplicates.js
@@ -36,7 +36,7 @@
data: url_params,
dataType: 'json'
}).done(function(response) {
- if ( response.pins.length ){
+ if (response.pins.length && take_effect()) {
render_duplicate_list(response);
render_duplicate_pins(response);
} else {
@@ -132,7 +132,7 @@
$(this).addClass('hidden');
$(this).find('ul').empty();
});
- if ( $('#problem_form').length ) {
+ if ($('#problem_form').length && take_effect()) {
$('.js-hide-if-invalid-category').slideDown();
}
}
@@ -158,6 +158,17 @@
refresh_duplicate_list();
}
+ function take_effect() {
+ // We do not want to do anything if any other message is being shown
+ if (document.getElementById('js-category-stopper')) {
+ return false;
+ }
+ if ($('.js-responsibility-message:visible').length) {
+ return false;
+ }
+ return true;
+ }
+
// Want to show potential duplicates when a regular user starts a new
// report, or changes the category/location of a partial report.
$(fixmystreet).on('report_new:category_change', refresh_duplicate_list);