discourse/app/helpers/embed_helper.rb
Jarek Radosz 71834c898f
DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-10-06 16:11:01 +02:00

24 lines
578 B
Ruby

# frozen_string_literal: true
module EmbedHelper
def embed_post_date(dt)
current = Time.now
if dt >= 1.day.ago
distance_of_time_in_words(dt, current)
else
if dt.year == current.year
dt.strftime I18n.t("datetime_formats.formats.short_no_year")
else
dt.strftime I18n.t("datetime_formats.formats.no_day")
end
end
end
def get_html(post)
key = "js.action_codes.#{post.action_code}"
cooked = (post.cooked.presence || I18n.t(key, when: nil).humanize)
raw PrettyText.format_for_email(cooked, post)
end
end