* services: scan spoiler_text for hashtags (#699) * views: link hashtags from spoiler_texts This covers linking hashtags from within the spoiler text on the server-generated pages. * services: fix string concat going into hashtag RE Cleaner Ruby syntax, may handle immutable strings better
This commit is contained in:
@ -25,6 +25,17 @@ class Formatter
|
||||
sanitize(html, Sanitize::Config::MASTODON_STRICT).html_safe # rubocop:disable Rails/OutputSafety
|
||||
end
|
||||
|
||||
def format_spoiler(status)
|
||||
return reformat(status.spoiler_text) unless status.local?
|
||||
|
||||
html = status.spoiler_text
|
||||
html = encode(html)
|
||||
html = html.delete("\n")
|
||||
html = link_hashtags(html)
|
||||
|
||||
html.html_safe # rubocop:disable Rails/OutputSafety
|
||||
end
|
||||
|
||||
def plaintext(status)
|
||||
return status.text if status.local?
|
||||
strip_tags(status.text)
|
||||
|
Reference in New Issue
Block a user