Skip to content

Commit

Permalink
Update feedback url and related test
Browse files Browse the repository at this point in the history
  • Loading branch information
Asheem Mamoowala committed Jan 17, 2019
1 parent f66be3f commit 4cc2a7d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ui/control/attribution_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class AttributionControl {
}
return acc;
}, `?`);
editLink.href = `https://www.mapbox.com/feedback/${paramString}${this._map._hash ? this._map._hash.getHashString(true) : ''}`;
editLink.href = `${config.FEEDBACK_URL}/${paramString}${this._map._hash ? this._map._hash.getHashString(true) : ''}`;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/util/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
type Config = {|
API_URL: string,
EVENTS_URL: string,
FEEDBACK_URL: string,
REQUIRE_ACCESS_TOKEN: boolean,
ACCESS_TOKEN: ?string,
MAX_PARALLEL_IMAGE_REQUESTS: number
Expand All @@ -17,6 +18,7 @@ const config: Config = {
return 'https://events.mapbox.com/events/v2';
}
},
FEEDBACK_URL: 'https://apps.mapbox.com/feedback',
REQUIRE_ACCESS_TOKEN: true,
ACCESS_TOKEN: null,
MAX_PARALLEL_IMAGE_REQUESTS: 16
Expand Down
7 changes: 4 additions & 3 deletions test/unit/ui/control/attribution.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ test('AttributionControl dedupes attributions that are substrings of others', (t
});

test('AttributionControl has the correct edit map link', (t) => {
config.FEEDBACK_URL = "https://feedback.com";
const map = createMap(t);
const attribution = new AttributionControl();
map.addControl(attribution);
map.on('load', () => {
map.addSource('1', { type: 'geojson', data: { type: 'FeatureCollection', features: [] }, attribution: '<a class="mapbox-improve-map" href="https://www.mapbox.com/feedback/" target="_blank">Improve this map</a>'});
map.addSource('1', { type: 'geojson', data: { type: 'FeatureCollection', features: [] }, attribution: '<a class="mapbox-improve-map" href="https://feedback.com" target="_blank">Improve this map</a>'});
map.addLayer({ id: '1', type: 'fill', source: '1' });
map.on('data', (e) => {
if (e.dataType === 'source' && e.sourceDataType === 'metadata') {
t.equal(attribution._editLink.href, 'https://www.mapbox.com/feedback/?owner=mapbox&id=streets-v10&access_token=pk.123#/0/0/0', 'edit link contains map location data');
t.equal(attribution._editLink.href, 'https://feedback.com/?owner=mapbox&id=streets-v10&access_token=pk.123#/0/0/0', 'edit link contains map location data');
map.setZoom(2);
t.equal(attribution._editLink.href, 'https://www.mapbox.com/feedback/?owner=mapbox&id=streets-v10&access_token=pk.123#/0/0/2', 'edit link updates on mapmove');
t.equal(attribution._editLink.href, 'https://feedback.com/?owner=mapbox&id=streets-v10&access_token=pk.123#/0/0/2', 'edit link updates on mapmove');
t.end();
}
});
Expand Down

0 comments on commit 4cc2a7d

Please sign in to comment.