statuses_helper.rb 370 B

123456789101112131415
  1. # frozen_string_literal: true
  2. module Admin::Trends::StatusesHelper
  3. def one_line_preview(status)
  4. text = if status.local?
  5. status.text.split("\n").first
  6. else
  7. Nokogiri::HTML(status.text).css('html > body > *').first&.text
  8. end
  9. return '' if text.blank?
  10. prerender_custom_emojis(h(text), status.emojis)
  11. end
  12. end