aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-07-07 09:54:05 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-07-07 09:54:05 +0100
commitd597f5012f2db5408eb0a913a789bbe2de4d923a (patch)
treefd7c98def178475cc70325317bf13cb607aa0d77
parent98f952a704c6dcbb569e8dc3a84a849597ad5a88 (diff)
parentd8245e7e9d54c538b674e44d5d5d8cfd796d5676 (diff)
Merge branch 'fix-duplicate-asset-selection-message'
-rw-r--r--CHANGELOG.md1
-rw-r--r--web/cobrands/buckinghamshire/assets.js2
-rw-r--r--web/cobrands/fixmystreet/assets.js8
3 files changed, 8 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5e42de4e..3d05be748 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
- Include file extensions in Dropzone accepted photo config.
- Fix photo orientation in modern browsers.
- Improve compatibility with G Suite OpenID Connect authentication. #3032
+ - Fix duplicate asset message after dismissing duplicate suggestions.
- Admin improvements:
- Display user name/email for contributed as reports. #2990
- Interface for enabling anonymous reports for certain categories. #2989
diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js
index 7c8995e41..3130c7fa7 100644
--- a/web/cobrands/buckinghamshire/assets.js
+++ b/web/cobrands/buckinghamshire/assets.js
@@ -63,7 +63,7 @@ var labeled_defaults = $.extend(true, {}, defaults, {
stylemap: streetlight_stylemap,
construct_asset_name: function(id) {
var code = id.replace(/[O0-9]+[A-Z]*/g, '');
- return {id: id, name: streetlight_code_to_type[code]};
+ return {id: id, name: streetlight_code_to_type[code] || 'street light'};
},
actions: {
asset_found: fixmystreet.assets.named_select_action_found,
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index ffa342e5f..56055ec52 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -419,10 +419,10 @@ function check_zoom_message_visibility() {
category = $("select#" + select).val() || '',
prefix = category.replace(/[^a-z]/gi, ''),
id = "category_meta_message_" + prefix,
- $p = $('#' + id),
+ $p = $('.category_meta_message'),
message;
if ($p.length === 0) {
- $p = $("<p>").prop("id", id).prop('class', 'category_meta_message');
+ $p = $("<p>").prop('class', 'category_meta_message');
if ($('html').hasClass('mobile')) {
$p.click(function() {
$("#mob_ok").trigger('click');
@@ -430,6 +430,7 @@ function check_zoom_message_visibility() {
}
$p.prependTo('#js-post-category-messages');
}
+ $p.prop('id', id);
if (this.getVisibility() && this.inRange) {
message = get_asset_pick_message.call(this);
@@ -453,6 +454,9 @@ function get_asset_pick_message() {
return message;
}
+/* This doesn't just use the class because e.g. an unselect event
+ * can fire after a category change event, and that would then
+ * update the new message using the text of the unselected layer. */
function update_message_display(message) {
if (this.fixmystreet.asset_group) {
_update_message(message, this.fixmystreet.asset_group);