enabled: true
EsLint:
enabled: true
- command: ["bin/yarn", "eslint", "-c", "config/eslint.js"]
+ command: ["bin/yarn", "eslint", "-c", "config/eslint.config.mjs"]
exclude:
- vendor/**/*.js
RailsSchemaUpToDate:
{
"eslint.options": {
- "overrideConfigFile": "config/eslint.js"
+ "overrideConfigFile": "config/eslint.config.mjs"
}
}
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
- nokogiri (1.18.2)
+ nokogiri (1.18.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
oauth (1.1.0)
$(".directions_form .btn-close").on("click", function (e) {
e.preventDefault();
- $(".describe_location").toggle(!endpoints[0].value);
- $(".search_form input[name='query']").val(endpoints[0].value);
+ $(".describe_location").toggle(!endpoints[1].value);
+ $(".search_form input[name='query']").val(endpoints[1].value);
OSM.router.route("/" + OSM.formatHash(map));
});
e.preventDefault();
const query = $(this).closest("form").find("input[name=query]").val();
let search = "";
- if (query) search = "?" + new URLSearchParams({ from: query });
+ if (query) search = "?" + new URLSearchParams({ to: query });
OSM.router.route("/directions" + search + OSM.formatHash(map));
});
before_action :check_database_readable
def show
- @user = current_user
+ @followings = current_user.followings
+ @nearby_users = current_user.nearby - @followings
end
end
<div class="col">
<p class='text-body-secondary mb-0'>
<%= link_to contact.display_name, contact %>
- <% if @user.home_location? and contact.home_location? %>
- <% distance = @user.distance(contact) %>
+ <% if current_user.home_location? and contact.home_location? %>
+ <% distance = current_user.distance(contact) %>
<% if distance < 1 %>
(<%= t ".m away", :count => (distance * 1000).round %>)
<% else %>
<% end %>
<div class="row">
- <% if current_user and @user.id == current_user.id %>
- <div class="col-md order-md-last">
- <% if !@user.home_location? %>
- <div id="map" class="content_map border border-secondary-subtle">
- <p class="m-3"><%= t(".no_home_location_html", :edit_profile_link => link_to(t(".edit_your_profile"), edit_profile_path)) %></p>
- </div>
- <% else %>
- <% content_for :head do %>
- <%= javascript_include_tag "user" %>
- <% end %>
- <% user_data = {
- :lon => current_user.home_lon,
- :lat => current_user.home_lat,
- :icon => image_path("marker-red.png"),
- :description => render(:partial => "popup", :object => current_user, :locals => { :type => "your location" })
- } %>
- <%= tag.div "", :id => "map", :class => "content_map border border-secondary-subtle rounded z-0", :data => { :user => user_data } %>
+ <div class="col-md order-md-last">
+ <% if !current_user.home_location? %>
+ <div id="map" class="content_map border border-secondary-subtle">
+ <p class="m-3"><%= t(".no_home_location_html", :edit_profile_link => link_to(t(".edit_your_profile"), edit_profile_path)) %></p>
+ </div>
+ <% else %>
+ <% content_for :head do %>
+ <%= javascript_include_tag "user" %>
<% end %>
+ <% user_data = {
+ :lon => current_user.home_lon,
+ :lat => current_user.home_lat,
+ :icon => image_path("marker-red.png"),
+ :description => render(:partial => "popup", :object => current_user, :locals => { :type => "your location" })
+ } %>
+ <%= tag.div "", :id => "map", :class => "content_map border border-secondary-subtle rounded z-0", :data => { :user => user_data } %>
+ <% end %>
+ </div>
- <% followings = @user.followings %>
- <% nearby = @user.nearby - followings %>
- </div>
+ <div class="col-md">
+ <h2><%= t ".followings" %></h2>
- <div class="col-md">
- <h2><%= t ".followings" %></h2>
+ <% if @followings.empty? %>
+ <%= t ".no followings" %>
+ <% else %>
+ <nav class='secondary-actions mb-3'>
+ <ul class='clearfix'>
+ <li><%= link_to t(".followed_changesets"), friend_changesets_path %></li>
+ <li><%= link_to t(".followed_diaries"), friends_diary_entries_path %></li>
+ </ul>
+ </nav>
+ <div>
+ <%= render :partial => "contact", :collection => @followings, :locals => { :type => "following" } %>
+ </div>
+ <% end %>
- <% if followings.empty? %>
- <%= t ".no followings" %>
- <% else %>
- <nav class='secondary-actions mb-3'>
- <ul class='clearfix'>
- <li><%= link_to t(".followed_changesets"), friend_changesets_path %></li>
- <li><%= link_to t(".followed_diaries"), friends_diary_entries_path %></li>
- </ul>
- </nav>
- <div>
- <%= render :partial => "contact", :collection => followings, :locals => { :type => "following" } %>
- </div>
- <% end %>
-
- <hr>
+ <hr>
- <h2><%= t ".nearby users" %></h2>
+ <h2><%= t ".nearby users" %></h2>
- <% if nearby.empty? %>
- <%= t ".no nearby users" %>
- <% else %>
- <nav class='secondary-actions mb-3'>
- <ul class='clearfix'>
- <li><%= link_to t(".nearby_changesets"), nearby_changesets_path %></li>
- <li><%= link_to t(".nearby_diaries"), nearby_diary_entries_path %></li>
- </ul>
- </nav>
- <div id="nearbyusers">
- <%= render :partial => "contact", :collection => nearby, :locals => { :type => "nearby mapper" } %>
- </div>
- <% end %>
- </div>
- <% end %>
+ <% if @nearby_users.empty? %>
+ <%= t ".no nearby users" %>
+ <% else %>
+ <nav class='secondary-actions mb-3'>
+ <ul class='clearfix'>
+ <li><%= link_to t(".nearby_changesets"), nearby_changesets_path %></li>
+ <li><%= link_to t(".nearby_diaries"), nearby_diary_entries_path %></li>
+ </ul>
+ </nav>
+ <div id="nearbyusers">
+ <%= render :partial => "contact", :collection => @nearby_users, :locals => { :type => "nearby mapper" } %>
+ </div>
+ <% end %>
+ </div>
</div>
-const globals = require("globals");
-const js = require("@eslint/js");
-const erb = require("eslint-plugin-erb");
-const stylisticJs = require("@stylistic/eslint-plugin-js");
+import globals from "globals";
+import js from "@eslint/js";
+import erb from "eslint-plugin-erb";
+import stylisticJs from "@stylistic/eslint-plugin-js";
-module.exports = [
+export default [
js.configs.recommended,
erb.configs.recommended,
{
}
},
{
- files: ["config/eslint.js"],
+ files: ["config/eslint.config.mjs"],
languageOptions: {
- ecmaVersion: 2019,
- sourceType: "commonjs",
- globals: {
- ...globals.commonjs
- }
+ sourceType: "module"
},
rules: {
"sort-keys": ["error", "asc", { minKeys: 5 }]
end
def config_file
- Rails.root.join("config/eslint.js").to_s
+ Rails.root.join("config/eslint.config.mjs").to_s
end
namespace "eslint" do
"osm-community-index": "^5.2.0"
},
"devDependencies": {
- "@types/jquery": "^3.5.32",
- "@types/leaflet": "^1.9.16",
+ "@types/jquery": "^3.5.0",
+ "@types/leaflet": "^1.9.0",
"eslint": "^9.0.0",
"eslint-plugin-erb": "^2.1.0",
- "@stylistic/eslint-plugin-js": "^3.0.0",
+ "@stylistic/eslint-plugin-js": "^4.0.0",
"eslint-formatter-compact": "^8.40.0"
}
}
end
end
+ def test_show_tags
+ changeset = create(:changeset, :closed)
+ create(:changeset_tag, :changeset => changeset, :k => "created_by", :v => "JOSM/1.5 (18364)")
+ create(:changeset_tag, :changeset => changeset, :k => "comment", :v => "changeset comment")
+
+ get changeset_show_path(changeset)
+
+ assert_response :success
+ assert_dom "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", 1
+ assert_single_changeset changeset do
+ assert_dom "> tag", 2
+ assert_dom "> tag[k='created_by'][v='JOSM/1.5 (18364)']", 1
+ assert_dom "> tag[k='comment'][v='changeset comment']", 1
+ end
+ end
+
def test_show_json
changeset = create(:changeset)
assert js["changeset"]["comments"][2]["visible"]
end
- def test_show_tag_and_discussion_json
+ def test_show_tags_json
changeset = create(:changeset, :closed)
create(:changeset_tag, :changeset => changeset, :k => "created_by", :v => "JOSM/1.5 (18364)")
create(:changeset_tag, :changeset => changeset, :k => "comment", :v => "changeset comment")
- create_list(:changeset_comment, 3, :changeset_id => changeset.id)
- get changeset_show_path(changeset), :params => { :format => "json", :include_discussion => true }
- assert_response :success, "cannot get closed changeset with comments"
+ get changeset_show_path(changeset, :format => "json")
+ assert_response :success
js = ActiveSupport::JSON.decode(@response.body)
-
assert_not_nil js
assert_equal Settings.api_version, js["version"]
assert_equal Settings.generator, js["generator"]
assert_single_changeset_json changeset, js
assert_equal 2, js["changeset"]["tags"].count
- assert_equal 3, js["changeset"]["comments"].count
- assert_not_nil js["changeset"]["comments"][0]["uid"]
- assert_not_nil js["changeset"]["comments"][0]["user"]
- assert_not_nil js["changeset"]["comments"][0]["text"]
+ assert_equal "JOSM/1.5 (18364)", js["changeset"]["tags"]["created_by"]
+ assert_equal "changeset comment", js["changeset"]["tags"]["comment"]
end
def test_show_bbox_json
{ :controller => "dashboards", :action => "show" }
)
end
+
+ def test_show_unauthorized
+ get dashboard_path
+
+ assert_redirected_to login_path(:referer => dashboard_path)
+ end
end
resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.4.1.tgz#9a96ce501bc62df46c4031fbd970e3cc6b10f07b"
integrity sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==
-"@stylistic/eslint-plugin-js@^3.0.0":
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-js/-/eslint-plugin-js-3.1.0.tgz#b36292b09bd810ea1b34e0720512f137335ef745"
- integrity sha512-lQktsOiCr8S6StG29C5fzXYxLOD6ID1rp4j6TRS+E/qY1xd59Fm7dy5qm9UauJIEoSTlYx6yGsCHYh5UkgXPyg==
+"@stylistic/eslint-plugin-js@^4.0.0":
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-js/-/eslint-plugin-js-4.0.1.tgz#c55e59ad2f00914f9eb103ba9e7be00aff7715dd"
+ integrity sha512-2EGKM6WHnZSidWKCu6ePJCqdpgWiEU1Bt26ktWEfTpCmRP+2vRQ6ViK8X6DLwu4+F0zPLy/Txe2HhI3qJFUvqA==
dependencies:
eslint-visitor-keys "^4.2.0"
espree "^10.3.0"
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.16.tgz#8ebe53d69efada7044454e3305c19017d97ced2a"
integrity sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==
-"@types/jquery@^3.5.32":
+"@types/jquery@^3.5.0":
version "3.5.32"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.5.32.tgz#3eb0da20611b92c7c49ebed6163b52a4fdc57def"
integrity sha512-b9Xbf4CkMqS02YH8zACqN1xzdxc3cO735Qe5AbSUFmyOiaWAbcpqh9Wna+Uk0vgACvoQHpWDg2rGdHkYPLmCiQ==
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
-"@types/leaflet@^1.9.16":
+"@types/leaflet@^1.9.0":
version "1.9.16"
resolved "https://registry.yarnpkg.com/@types/leaflet/-/leaflet-1.9.16.tgz#3e3abc103e106523cde01625057e2294f332ec3b"
integrity sha512-wzZoyySUxkgMZ0ihJ7IaUIblG8Rdc8AbbZKLneyn+QjYsj5q1QU7TEKYqwTr10BGSzY5LI7tJk9Ifo+mEjdFRw==