Skip to content

Commit 65f5331

Browse files
Check attributions text before loading them #2261
Merge pull request #2261 from CartoDB/feature/sc-89763/teqstream-duplicate-carto-logo-in-attribution
2 parents f0cd67a + c9a9774 commit 65f5331

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/geo/ui/attribution/attribution-view.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ module.exports = View.extend({
3131
},
3232

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

4751
_initBinds: function () {
4852
this.model.bind('change:visible', function (mdl, isVisible) {
49-
this[ isVisible ? '_showAttributions' : '_hideAttributions' ]();
53+
this[isVisible ? '_showAttributions' : '_hideAttributions']();
5054
}, this);
5155
this.map.bind('change:attribution', this.render, this);
5256
this.add_related_model(this.map);

0 commit comments

Comments
 (0)