statuses_helper.rb 370 B

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