Rewrite bbox only in place history atom links

This commit is contained in:
Anton Khorev 2022-09-07 22:13:57 +03:00
parent 2948b86eb5
commit 1fc2a70c17
2 changed files with 19 additions and 5 deletions

View file

@ -48,6 +48,9 @@ OSM.History = function (map) {
if (window.location.pathname === "/history") {
data.bbox = map.getBounds().wrap().toBBoxString();
var feedLink = $("link[type=\"application/atom+xml\"]"),
feedHref = feedLink.attr("href").split("?")[0];
feedLink.attr("href", feedHref + "?bbox=" + data.bbox);
}
$.ajax({
@ -59,11 +62,6 @@ OSM.History = function (map) {
updateMap();
}
});
var feedLink = $("link[type=\"application/atom+xml\"]"),
feedHref = feedLink.attr("href").split("?")[0];
feedLink.attr("href", feedHref + "?bbox=" + data.bbox);
}
function loadMore(e) {

View file

@ -0,0 +1,16 @@
require "application_system_test_case"
class HistoryTest < ApplicationSystemTestCase
test "atom link on user's history is not modified" do
user = create(:user)
create(:changeset, :user => user, :num_changes => 1) do |changeset|
create(:changeset_tag, :changeset => changeset, :k => "comment", :v => "first-changeset-in-history")
end
visit "#{user_path(user)}/history"
changesets = find "div.changesets"
changesets.assert_text "first-changeset-in-history"
assert_css "link[type='application/atom+xml'][href$='#{user_path(user)}/history/feed']", :visible => false
end
end