]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4927'
authorTom Hughes <tom@compton.nu>
Sun, 30 Jun 2024 09:28:02 +0000 (10:28 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 30 Jun 2024 09:28:02 +0000 (10:28 +0100)
app/assets/javascripts/embed.js.erb
app/controllers/messages_controller.rb
app/helpers/user_helper.rb
app/views/application/_auth_providers.html.erb
config/banners.yml
config/locales/en.yml
test/controllers/messages_controller_test.rb
test/helpers/user_helper_test.rb
test/system/embed_test.rb [new file with mode: 0644]
yarn.lock

index 4ebb89da93134a422133640e6680119c6ab9e752..9a0ec07d31d85855c06a02d0179d29f7a298d207 100644 (file)
@@ -5,13 +5,13 @@
 //= require i18n
 //= require i18n/embed
 
-window.onload = function () {
-  if (navigator.languages) {
-    I18n.locale = navigator.languages[0];
-  } else if (navigator.language) {
-    I18n.locale = navigator.language;
-  }
+if (navigator.languages) {
+  I18n.locale = navigator.languages[0];
+} else if (navigator.language) {
+  I18n.locale = navigator.language;
+}
 
+window.onload = function () {
   var query = (window.location.search || '?').slice(1),
       args  = {};
 
index 779174e255ffc915fe14f44c67e2710b8cb87cba..e4d6c70d9afb5809ef87fbf0d92588bfc465fc53 100644 (file)
@@ -117,7 +117,7 @@ class MessagesController < ApplicationController
 
   # Set the message as being read or unread.
   def mark
-    @message = Message.where(:recipient => current_user).or(Message.where(:sender => current_user)).find(params[:message_id])
+    @message = current_user.messages.find(params[:message_id])
     if params[:mark] == "unread"
       message_read = false
       notice = t ".as_unread"
index 4f5d7e0c2d4d52b10a6f5aa227d8c9c5c4f668f6..d767cb887c4730612c991a68f2a86f17d3796150 100644 (file)
@@ -64,7 +64,7 @@ module UserHelper
                 :size => "36"),
       auth_path(options.merge(:provider => provider)),
       :method => :post,
-      :class => "auth_button p-2 d-block",
+      :class => "auth_button btn btn-light mx-1 p-2 d-block",
       :title => t("application.auth_providers.#{name}.title")
     )
   end
@@ -77,7 +77,7 @@ module UserHelper
                 :size => "36") + t("application.auth_providers.#{name}.title"),
       auth_path(options.merge(:provider => provider)),
       :method => :post,
-      :class => "auth_button fs-6 border rounded text-body-secondary text-decoration-none py-2 px-4 d-flex justify-content-center align-items-center",
+      :class => "auth_button btn btn-outline-secondary fs-6 border rounded py-2 px-4 d-flex justify-content-center align-items-center",
       :title => t("application.auth_providers.#{name}.title")
     )
   end
index e92c9caac75d6ef65dbb8321b181ae3eee97be3f..be921ee9cfdf84bf837de36dae9a0d0614b5d973 100644 (file)
@@ -31,7 +31,7 @@
                   "#",
                   :id => "openid_open_url",
                   :title => t("application.auth_providers.openid.title"),
-                  :class => "p-2 d-block" %>
+                  :class => "btn btn-light mx-1 p-2 d-block" %>
 
       <% %w[google facebook microsoft github wikipedia].each do |provider| %>
         <% unless @preferred_auth_provider == provider %>
index d9eb92c13e6619971eddff41e4fc0192d52051e7..bc5497a4cedc56a694dee94854ba52ab9bcbb337 100644 (file)
@@ -11,7 +11,7 @@ donate_2023:
 sotmeu_2024:
   id: sotmeu_2024
   alt: State of the Map Europe 2024
-  link: https://tobilet.pl/state-of-the-map-europe-2024.html
+  link: https://stateofthemap.eu/
   img: banners/StateoftheMapEurope_2024.png
   enddate: 2024-jul-18
 sotmasia_2023:
index 4ad1687a6cf991dda1161a66a5434488852a18d5..6c90eacc9ea1e603dd5817dd06d710a4f8c7e078 100644 (file)
@@ -837,6 +837,7 @@ en:
           college: "College Building"
           commercial: "Commercial Building"
           construction: "Building under Construction"
+          cowshed: "Cowshed"
           detached: "Detached House"
           dormitory: "Dormitory"
           duplex: "Duplex House"
@@ -866,6 +867,7 @@ en:
           shed: "Shed"
           stable: "Stable"
           static_caravan: "Caravan"
+          sty: "Sty"
           temple: "Temple Building"
           terrace: "Terrace Building"
           train_station: "Train Station Building"
index db3a200b644711b40bfd91fbffcb20510c443878..3f19b5819b9f9e10ceb02b0d541830c0da20eec6 100644 (file)
@@ -369,10 +369,10 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
   ##
   # test the mark action
   def test_mark
-    user = create(:user)
+    sender_user = create(:user)
     recipient_user = create(:user)
     other_user = create(:user)
-    message = create(:message, :unread, :sender => user, :recipient => recipient_user)
+    message = create(:message, :unread, :sender => sender_user, :recipient => recipient_user)
 
     # Check that the marking a message requires us to login
     post message_mark_path(message)
@@ -386,6 +386,14 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     assert_response :not_found
     assert_template "no_such_message"
 
+    # Login as the message sender_user
+    session_for(sender_user)
+
+    # Check that marking a message we sent fails
+    post message_mark_path(message)
+    assert_response :not_found
+    assert_template "no_such_message"
+
     # Login as the message recipient_user
     session_for(recipient_user)
 
index ed05aca36dffc002447c8938837e6ad7fed826ee..c7c63d62abebbf9ff8f83a521241f765c431ea52 100644 (file)
@@ -117,7 +117,7 @@ class UserHelperTest < ActionView::TestCase
   def test_auth_button
     button = auth_button("google", "google")
     img_tag = "<img alt=\"Log in with a Google OpenID\" class=\"rounded-1\" src=\"/images/google.svg\" width=\"36\" height=\"36\" />"
-    assert_equal("<a class=\"auth_button p-2 d-block\" title=\"Log in with Google\" rel=\"nofollow\" data-method=\"post\" href=\"/auth/google\">#{img_tag}</a>", button)
+    assert_equal("<a class=\"auth_button btn btn-light mx-1 p-2 d-block\" title=\"Log in with Google\" rel=\"nofollow\" data-method=\"post\" href=\"/auth/google\">#{img_tag}</a>", button)
   end
 
   private
diff --git a/test/system/embed_test.rb b/test/system/embed_test.rb
new file mode 100644 (file)
index 0000000..6003c6f
--- /dev/null
@@ -0,0 +1,19 @@
+require "application_system_test_case"
+
+class EmbedTest < ApplicationSystemTestCase
+  test "shows localized report link" do
+    visit export_embed_path
+    assert_link "Report a problem"
+  end
+end
+
+class GermanEmbedTest < ApplicationSystemTestCase
+  driven_by :selenium, :using => :headless_firefox, :options => { :name => :selenium_de } do |options|
+    options.add_preference("intl.accept_languages", "de")
+  end
+
+  test "shows localized report link" do
+    visit export_embed_path
+    assert_link "Ein Problem melden"
+  end
+end
index 040bf124c8cc992fdcb1490c3a2810648ad7bfe3..914ebb8c61363cd440df87722c383f2af4d82669 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
   resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8"
   integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==
 
-"@eslint/config-array@^0.16.0":
-  version "0.16.0"
-  resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.16.0.tgz#bb3364fc39ee84ec3a62abdc4b8d988d99dfd706"
-  integrity sha512-/jmuSd74i4Czf1XXn7wGRWZCuyaUZ330NH1Bek0Pplatt4Sy1S5haN21SCLLdbeKslQ+S0wEJ+++v5YibSi+Lg==
+"@eslint/config-array@^0.17.0":
+  version "0.17.0"
+  resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.17.0.tgz#ff305e1ee618a00e6e5d0485454c8d92d94a860d"
+  integrity sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==
   dependencies:
     "@eslint/object-schema" "^2.1.4"
     debug "^4.3.1"
-    minimatch "^3.0.5"
+    minimatch "^3.1.2"
 
 "@eslint/eslintrc@^3.1.0":
   version "3.1.0"
     minimatch "^3.1.2"
     strip-json-comments "^3.1.1"
 
-"@eslint/js@9.5.0":
-  version "9.5.0"
-  resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.5.0.tgz#0e9c24a670b8a5c86bff97b40be13d8d8f238045"
-  integrity sha512-A7+AOT2ICkodvtsWnxZP4Xxk3NbZ3VMHd8oihydLRGrJgqqdEz1qSeEgXYyT/Cu8h1TWWsQRejIx48mtjZ5y1w==
+"@eslint/js@9.6.0":
+  version "9.6.0"
+  resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.6.0.tgz#5b0cb058cc13d9c92d4e561d3538807fa5127c95"
+  integrity sha512-D9B0/3vNg44ZeWbYMpBoXqNP4j6eQD5vNwIlGAuFRRzK/WtT/jvDQW3Bi9kkf3PMDMlM7Yi+73VLUsn5bJcl8A==
 
 "@eslint/object-schema@^2.1.4":
   version "2.1.4"
@@ -89,10 +89,10 @@ acorn-jsx@^5.3.2:
   resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
   integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==
 
-acorn@^8.11.3:
-  version "8.11.3"
-  resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a"
-  integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==
+acorn@^8.12.0:
+  version "8.12.0"
+  resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.0.tgz#1627bfa2e058148036133b8d9b51a700663c294c"
+  integrity sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==
 
 ajv@^6.12.4:
   version "6.12.6"
@@ -246,15 +246,15 @@ eslint-visitor-keys@^4.0.0:
   integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==
 
 eslint@^9.0.0:
-  version "9.5.0"
-  resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.5.0.tgz#11856034b94a9e1a02cfcc7e96a9f0956963cd2f"
-  integrity sha512-+NAOZFrW/jFTS3dASCGBxX1pkFD0/fsO+hfAkJ4TyYKwgsXZbqzrw+seCYFCcPCYXvnD67tAnglU7GQTz6kcVw==
+  version "9.6.0"
+  resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.6.0.tgz#9f54373afa15e1ba356656a8d96233182027fb49"
+  integrity sha512-ElQkdLMEEqQNM9Njff+2Y4q2afHk7JpkPvrd7Xh7xefwgQynqPxwf55J7di9+MEibWUGdNjFF9ITG9Pck5M84w==
   dependencies:
     "@eslint-community/eslint-utils" "^4.2.0"
     "@eslint-community/regexpp" "^4.6.1"
-    "@eslint/config-array" "^0.16.0"
+    "@eslint/config-array" "^0.17.0"
     "@eslint/eslintrc" "^3.1.0"
-    "@eslint/js" "9.5.0"
+    "@eslint/js" "9.6.0"
     "@humanwhocodes/module-importer" "^1.0.1"
     "@humanwhocodes/retry" "^0.3.0"
     "@nodelib/fs.walk" "^1.2.8"
@@ -265,7 +265,7 @@ eslint@^9.0.0:
     escape-string-regexp "^4.0.0"
     eslint-scope "^8.0.1"
     eslint-visitor-keys "^4.0.0"
-    espree "^10.0.1"
+    espree "^10.1.0"
     esquery "^1.5.0"
     esutils "^2.0.2"
     fast-deep-equal "^3.1.3"
@@ -285,12 +285,12 @@ eslint@^9.0.0:
     strip-ansi "^6.0.1"
     text-table "^0.2.0"
 
-espree@^10.0.1:
-  version "10.0.1"
-  resolved "https://registry.yarnpkg.com/espree/-/espree-10.0.1.tgz#600e60404157412751ba4a6f3a2ee1a42433139f"
-  integrity sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==
+espree@^10.0.1, espree@^10.1.0:
+  version "10.1.0"
+  resolved "https://registry.yarnpkg.com/espree/-/espree-10.1.0.tgz#8788dae611574c0f070691f522e4116c5a11fc56"
+  integrity sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==
   dependencies:
-    acorn "^8.11.3"
+    acorn "^8.12.0"
     acorn-jsx "^5.3.2"
     eslint-visitor-keys "^4.0.0"
 
@@ -541,7 +541,7 @@ lodash.merge@^4.6.2:
   resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
   integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
 
-minimatch@^3.0.5, minimatch@^3.1.2:
+minimatch@^3.1.2:
   version "3.1.2"
   resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
   integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==