Use friendly_date for note disappear description
There's no need to reimplement this in its own helper.
This commit is contained in:
parent
026fce06f4
commit
100a7f8979
3 changed files with 1 additions and 15 deletions
|
@ -21,9 +21,4 @@ module NoteHelper
|
|||
link_to h(author.display_name), link_options.merge(:controller => "/users", :action => "show", :display_name => author.display_name)
|
||||
end
|
||||
end
|
||||
|
||||
def disappear_in(note)
|
||||
date = note.freshly_closed_until
|
||||
tag.span(distance_of_time_in_words(date, Time.now.utc), :title => l(date, :format => :friendly))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
|
||||
<% if @note.freshly_closed? %>
|
||||
<small class="text-muted">
|
||||
<%= t ".disappear_date_html", :disappear_in => disappear_in(@note) %>
|
||||
<%= t ".disappear_date_html", :disappear_in => friendly_date(@note.freshly_closed_until) %>
|
||||
</small>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -21,13 +21,4 @@ class NoteHelperTest < ActionView::TestCase
|
|||
assert_equal "<a href=\"/user/#{ERB::Util.u(user.display_name)}\">#{user.display_name}</a>", note_author(user)
|
||||
assert_equal "<a href=\"http://test.host/user/#{ERB::Util.u(user.display_name)}\">#{user.display_name}</a>", note_author(user, :only_path => false)
|
||||
end
|
||||
|
||||
def test_disappear_in
|
||||
note_closed_date = Time.utc(2022, 1, 1, 12, 0, 0)
|
||||
note = create(:note, :closed_at => note_closed_date)
|
||||
|
||||
travel_to note_closed_date + 1.day do
|
||||
assert_match %r{^<span title=" 8 January 2022 at 12:00">6 days</span>$}, disappear_in(note)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue