diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-01-28 14:36:26 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-01-31 14:43:13 +0000 |
commit | b19c289953cbcab2fa99bd2f061f8c1955850d6b (patch) | |
tree | 12c0459535913905c5081ac46146fb82e6db1fc6 | |
parent | b7f518262497a54ee8367854d83f08ec942da641 (diff) |
No history entry for updates to new pin location.
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 48ae83103..c26b10d29 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -1285,9 +1285,13 @@ fixmystreet.update_pin = function(lonlat, savePushState) { if (savePushState !== false) { if ('pushState' in history) { var newReportUrl = '/report/new?longitude=' + lonlats.url.lon + '&latitude=' + lonlats.url.lat; - history.pushState({ - newReportAtLonlat: lonlats.state - }, null, newReportUrl); + var newState = { newReportAtLonlat: lonlats.state }; + // If we're already in the reporting place, we want to replace state, it's a pin move + if (fixmystreet.page === 'new') { + history.replaceState(newState, null, newReportUrl); + } else { + history.pushState(newState, null, newReportUrl); + } } } |