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
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"
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