A platform for community discussion. Free, open, simple.
UX: emphasizes on local-dates being UTC in excerpts (#8208)
Joffrey JAFFEUX54bc2bdba78e
diff --git a/plugins/discourse-local-dates/plugin.rb b/plugins/discourse-local-dates/plugin.rbindex 2adf23dca08..5ee9fefad73 100644--- a/plugins/discourse-local-dates/plugin.rb+++ b/plugins/discourse-local-dates/plugin.rb@@ -53,6 +53,12 @@ after_initialize docustom_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']diff --git a/plugins/discourse-local-dates/spec/lib/pretty_text_spec.rb b/plugins/discourse-local-dates/spec/lib/pretty_text_spec.rbindex 476dd54f3da..6a1a4ec76f7 100644--- a/plugins/discourse-local-dates/spec/lib/pretty_text_spec.rb+++ b/plugins/discourse-local-dates/spec/lib/pretty_text_spec.rb@@ -71,4 +71,13 @@ describe PrettyText doendendend++ 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+ endend