UX: emphasizes on local-dates being UTC in excerpts (#8208)
This commit is contained in:
parent
ecfba0bb37
commit
54bc2bdba7
|
@ -53,6 +53,12 @@ after_initialize do
|
|||
custom_fields[DiscourseLocalDates::POST_CUSTOM_FIELD] || []
|
||||
end
|
||||
|
||||
on(:reduce_excerpt) do |fragment, post|
|
||||
fragment.css('.discourse-local-date').each do |container|
|
||||
container.content = "#{container.content} (UTC)"
|
||||
end
|
||||
end
|
||||
|
||||
on(:reduce_cooked) do |fragment|
|
||||
fragment.css('.discourse-local-date').each do |container|
|
||||
if container.attributes['data-email-preview']
|
||||
|
|
|
@ -71,4 +71,13 @@ describe PrettyText do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'excerpt simplified rendering' do
|
||||
let(:post) { Fabricate(:post, raw: '[date=2019-10-16 time=14:00:00 format="LLLL" timezone="America/New_York"]') }
|
||||
|
||||
it 'adds UTC' do
|
||||
excerpt = PrettyText.excerpt(post.cooked, 200)
|
||||
expect(excerpt).to eq("Wednesday, October 16, 2019 6:00 PM (UTC)")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue