diff --git a/app/helpers/cards_helper.rb b/app/helpers/cards_helper.rb
index 574f6375f..ba61cb94e 100644
--- a/app/helpers/cards_helper.rb
+++ b/app/helpers/cards_helper.rb
@@ -33,6 +33,10 @@ module CardsHelper
title.join(" ")
end
+ def card_drafted_or_added(card)
+ card.drafted? ? "Drafted" : "Added"
+ end
+
def card_social_tags(card)
tag.meta(property: "og:title", content: "#{card.title} | #{card.board.name}") +
tag.meta(property: "og:description", content: format_excerpt(@card&.description, length: 200)) +
diff --git a/app/models/card/statuses.rb b/app/models/card/statuses.rb
index 2639d88b7..d339acd17 100644
--- a/app/models/card/statuses.rb
+++ b/app/models/card/statuses.rb
@@ -20,7 +20,7 @@ module Card::Statuses
private
def update_created_at_on_publication
if will_save_change_to_status? && status_in_database.inquiry.drafted?
- self.created_at = Time.now
+ self.created_at = Time.current
end
end
end
diff --git a/app/views/cards/display/common/_meta.html.erb b/app/views/cards/display/common/_meta.html.erb
index 27a8c9cf7..521230c0d 100644
--- a/app/views/cards/display/common/_meta.html.erb
+++ b/app/views/cards/display/common/_meta.html.erb
@@ -4,7 +4,7 @@
- Added <%= local_datetime_tag(card.created_at, style: :daysago) %>
+ <%= card_drafted_or_added(card) %> <%= local_datetime_tag(card.created_at, style: :daysago) %>
diff --git a/app/views/cards/display/preview/_meta.html.erb b/app/views/cards/display/preview/_meta.html.erb
index 8ba8e04d8..c06c9a3e1 100644
--- a/app/views/cards/display/preview/_meta.html.erb
+++ b/app/views/cards/display/preview/_meta.html.erb
@@ -4,8 +4,7 @@
- <%= local_datetime_tag(card.created_at, style: :daysago) %>
- <% "(Draft)" if card.drafted? %>
+ <%= card_drafted_or_added(card) %> <%= local_datetime_tag(card.created_at, style: :daysago) %>
diff --git a/app/views/cards/display/public_preview/_meta.html.erb b/app/views/cards/display/public_preview/_meta.html.erb
index 948a6e73c..0547345f9 100644
--- a/app/views/cards/display/public_preview/_meta.html.erb
+++ b/app/views/cards/display/public_preview/_meta.html.erb
@@ -4,7 +4,7 @@
- Added <%= local_datetime_tag(card.created_at, style: :daysago) %>
+ <%= card_drafted_or_added(card) %> <%= local_datetime_tag(card.created_at, style: :daysago) %>
diff --git a/test/models/card/statuses_test.rb b/test/models/card/statuses_test.rb
index 83179fbc4..ba801bfd9 100644
--- a/test/models/card/statuses_test.rb
+++ b/test/models/card/statuses_test.rb
@@ -65,6 +65,6 @@ class Card::StatusesTest < ActiveSupport::TestCase
card.publish
- assert_equal Time.now, card.created_at
+ assert_equal Time.current, card.created_at
end
end