Skip to content

Commit

Permalink
Check attributions text before loading them #2261
Browse files Browse the repository at this point in the history
Merge pull request #2261 from CartoDB/feature/sc-89763/teqstream-duplicate-carto-logo-in-attribution
  • Loading branch information
VictorVelarde committed Dec 28, 2021
2 parents f0cd67a + c9a9774 commit 65f5331
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/geo/ui/attribution/attribution-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ module.exports = View.extend({
},

render: function () {
var attributions = _.compact(this.map.get('attribution')).join(', ');
var emptyStringRegExp = new RegExp(/[A-z]/g);
var attributionsSet = [...new Set(this.map.get('attribution'))];
var attributions = _.compact(attributionsSet)
.filter(attribution => emptyStringRegExp.test(attribution))
.join(', ');
var isGMaps = this.map.get('provider') !== 'leaflet';
this.$el.html(
template({
Expand All @@ -46,7 +50,7 @@ module.exports = View.extend({

_initBinds: function () {
this.model.bind('change:visible', function (mdl, isVisible) {
this[ isVisible ? '_showAttributions' : '_hideAttributions' ]();
this[isVisible ? '_showAttributions' : '_hideAttributions']();
}, this);
this.map.bind('change:attribution', this.render, this);
this.add_related_model(this.map);
Expand Down

0 comments on commit 65f5331

Please sign in to comment.