]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'pull/5196'
authorAnton Khorev <tony29@yandex.ru>
Fri, 13 Sep 2024 08:48:38 +0000 (11:48 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 13 Sep 2024 08:48:38 +0000 (11:48 +0300)
app/controllers/friendships_controller.rb
config/i18n-tasks.yml
config/key.yml
config/locales/en.yml
test/system/friendships_test.rb [new file with mode: 0644]

index ab54cbfd1b31f7dcd8fec56d4e23ec9c5c92908e..8f0c1ad859c4332eb46c81d82db4e28d6a8fe755 100644 (file)
@@ -20,7 +20,7 @@ class FriendshipsController < ApplicationController
       if current_user.friends_with?(@friend)
         flash[:warning] = t ".already_a_friend", :name => @friend.display_name
       elsif current_user.friendships.where(:created_at => Time.now.utc - 1.hour..).count >= current_user.max_friends_per_hour
-        flash.now[:error] = t ".limit_exceeded"
+        flash[:error] = t ".limit_exceeded"
       elsif friendship.save
         flash[:notice] = t ".success", :name => @friend.display_name
         UserMailer.friendship_notification(friendship).deliver_later
index 01e70529d6af8409f9300075aa3c6c9424781bf0..225078a515e380b5a7ddf48f2f14ef809277f015 100644 (file)
@@ -130,6 +130,7 @@ ignore_unused:
   - 'datetime.distance_in_words_ago.*'
   - 'reports.new.categories.*' # double interpolation in reports_helper
   - 'shared.pagination.*'
+  - 'auth.providers.*'
 # - '{devise,kaminari,will_paginate}.*'
 # - 'simple_form.{yes,no}'
 # - 'simple_form.{placeholders,hints,labels}.*'
index dce65d53a67079fb95996a3f2999a1897cebd176..798d9ca546db80f0b82960bb79f0db13078615f0 100644 (file)
@@ -88,10 +88,15 @@ mapnik:
   - { min_zoom: 14, name: building, width: 10, height: 10, fill: "#ab9793" }
   - { min_zoom: 15, name: building, width: 10, height: 10, fill: "#b9a99c", border: "#a99a8d" }
   - { min_zoom: 16, name: building, width: 10, height: 10, fill: "#c4b6ab", border: "#a99a8d" }
-  # stations: stations.mss
-  - { min_zoom: 12, name: station, width: 4, height: 4, fill: "#7981b0" }
-  - { min_zoom: 13, name: station, width: 6, height: 6, fill: "#7981b0" }
+  # stations: stations.mss, amenity-points.mss
+  - { min_zoom: 12, max_zoom: 12, name: station, width: 4, height: 4, fill: "#7981b0" }
+  - { min_zoom: 13, max_zoom: 13, name: station, width: 6, height: 6, fill: "#7981b0" }
+  - { min_zoom: 13, max_zoom: 13, name: railway_halt, width: 4, height: 4, fill: "#7981b0" }
+  - { min_zoom: 14, max_zoom: 14, name: [station, subway_station], width: 6, height: 6, fill: "#7981b0" }
+  - { min_zoom: 14, max_zoom: 14, name: [railway_halt, tram_stop], width: 4, height: 4, fill: "#7981b0" }
   - { min_zoom: 15, name: station, width: 9, height: 9, fill: "#7981b0" }
+  - { min_zoom: 15, name: [railway_halt, subway_station, tram_stop], width: 6, height: 6, fill: "#7981b0" }
+  - { min_zoom: 16, name: bus_stop, width: 6, height: 6, fill: "#0092da" }
   # other
   - { min_zoom: 11, name: [summit, peak], image: summit.svg } # amenity-points.mss
   - { min_zoom: 13, name: tunnel, width: 50, height: 5, casing: grey, casing-dasharray: "4 2", casing-dashoffset: 1 } # roads.mss
index 545e03eb0344427972f01628f125ca8736b734ce..faf9a89852325c8643c866371f36327501338e9e 100644 (file)
@@ -38,8 +38,6 @@ en:
   activerecord:
     errors:
       messages:
-        invalid_email_address: does not appear to be a valid e-mail address
-        email_address_not_routable: is not routable
         display_name_is_user_n: can't be user_n unless n is your user id
       models:
         user_mute:
@@ -2375,6 +2373,9 @@ en:
           hospital: "Hospital"
           building: "Significant building"
           station: "Railway station"
+          railway_halt: "Railway halt"
+          subway_station: "Subway station"
+          tram_stop: "Tram stop"
           summit: "Summit"
           peak: "Peak"
           tunnel: "Dashed casing = tunnel"
diff --git a/test/system/friendships_test.rb b/test/system/friendships_test.rb
new file mode 100644 (file)
index 0000000..1db4d3c
--- /dev/null
@@ -0,0 +1,18 @@
+require "application_system_test_case"
+
+class FriendshipsTest < ApplicationSystemTestCase
+  test "show message when max frienships limit is exceeded" do
+    befriendee = create(:user)
+
+    sign_in_as create(:user)
+
+    with_settings(:max_friends_per_hour => 0) do
+      visit user_path(befriendee)
+      assert_link "Add Friend"
+
+      click_on "Add Friend"
+      assert_text "You have friended a lot of users recently"
+      assert_link "Add Friend"
+    end
+  end
+end