]> git.openstreetmap.org Git - rails.git/commitdiff
Use friendy_date_ago helper for notes
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 19 Jun 2019 10:00:58 +0000 (12:00 +0200)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 19 Jun 2019 16:04:08 +0000 (18:04 +0200)
Refs #2255

app/helpers/note_helper.rb
config/locales/en.yml
test/helpers/note_helper_test.rb

index 4b5be42d78b8786988be869e4dc5d2b5ca3c1901..dbe0c89f78e0f687f65934070b68f4ac94f1d6d4 100644 (file)
@@ -2,11 +2,11 @@ module NoteHelper
   def note_event(event, at, by)
     if by.nil?
       I18n.t("browse.note." + event + "_by_anonymous",
-             :when => friendly_date(at),
+             :when => friendly_date_ago(at),
              :exact_time => l(at)).html_safe
     else
       I18n.t("browse.note." + event + "_by",
-             :when => friendly_date(at),
+             :when => friendly_date_ago(at),
              :exact_time => l(at),
              :user => note_author(by)).html_safe
     end
index f49f05746719b626e513a3d3e23d406391a8ce67..c560c9c98ae9cfbbeb6d9887ab141fae6d2c1e30 100644 (file)
@@ -286,15 +286,15 @@ en:
       open_title: "Unresolved note #%{note_name}"
       closed_title: "Resolved note #%{note_name}"
       hidden_title: "Hidden note #%{note_name}"
-      open_by: "Created by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      open_by_anonymous: "Created by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      commented_by: "Comment from %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      commented_by_anonymous: "Comment from anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      closed_by: "Resolved by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      closed_by_anonymous: "Resolved by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      reopened_by: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      reopened_by_anonymous: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      hidden_by: "Hidden by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
+      open_by: "Created by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      open_by_anonymous: "Created by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
+      commented_by: "Comment from %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      commented_by_anonymous: "Comment from anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
+      closed_by: "Resolved by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      closed_by_anonymous: "Resolved by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
+      reopened_by: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      reopened_by_anonymous: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
+      hidden_by: "Hidden by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
       report: Report this note
     query:
       title: "Query Features"
index 408236879c49ea6c49b7b16445afb53af928ede7..ce82f3ab5b9df6c9daabe78a28e656cae17a2408 100644 (file)
@@ -8,8 +8,8 @@ class NoteHelperTest < ActionView::TestCase
     date = Time.new(2014, 3, 5, 21, 37, 45, "+00:00")
     user = create(:user)
 
-    assert_match %r{^Created by anonymous <abbr title='Wed, 05 Mar 2014 21:37:45 \+0000'><span title=" 5 March 2014 at 21:37">.*</span> ago</abbr>$}, note_event("open", date, nil)
-    assert_match %r{^Resolved by <a href="/user/#{ERB::Util.u(user.display_name)}">#{user.display_name}</a> <abbr title='Wed, 05 Mar 2014 21:37:45 \+0000'><span title=" 5 March 2014 at 21:37">.*</span> ago</abbr>$}, note_event("closed", date, user)
+    assert_match %r{^Created by anonymous <abbr title='Wed, 05 Mar 2014 21:37:45 \+0000'><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("open", date, nil)
+    assert_match %r{^Resolved by <a href="/user/#{ERB::Util.u(user.display_name)}">#{user.display_name}</a> <abbr title='Wed, 05 Mar 2014 21:37:45 \+0000'><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("closed", date, user)
   end
 
   def test_note_author