From d6f264c35a4aef78e1c9df75a63aee0eecbd9a7b Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 23 May 2019 12:51:45 +0100 Subject: Have duplicate and asset messages work together. --- web/js/duplicates.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'web/js/duplicates.js') 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); -- cgit v1.2.3