diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-05-12 21:33:37 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2019-05-17 23:51:14 +0200 |
commit | d7520f81759e9db58a5b5ca61b9114e9ef44d92f (patch) | |
tree | f7d14b9aad6cc910fb932526764e4f36e7345f0a /app | |
parent | 94aef563b9abbc449028f44c4aac84ef2e072d89 (diff) |
Add support for HTML-formatted toots
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/formatter.rb | 4 | ||||
-rw-r--r-- | app/models/status.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index fe5b5b7b7..eaece8797 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -37,9 +37,9 @@ class Formatter html = raw_content html = "RT @#{prepend_reblog} #{html}" if prepend_reblog html = format_markdown(html) if status.content_type == 'text/markdown' - html = encode_and_link_urls(html, linkable_accounts, keep_html: status.content_type == 'text/markdown') + html = encode_and_link_urls(html, linkable_accounts, keep_html: %w(text/markdown text/html).include?(status.content_type)) html = encode_custom_emojis(html, status.emojis, options[:autoplay]) if options[:custom_emojify] - html = simple_format(html, {}, sanitize: false) unless status.content_type == 'text/markdown' + html = simple_format(html, {}, sanitize: false) unless %w(text/markdown text/html).include?(status.content_type) html = html.delete("\n") html.html_safe # rubocop:disable Rails/OutputSafety diff --git a/app/models/status.rb b/app/models/status.rb index e0dc74790..6f3ba4cc3 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -75,7 +75,7 @@ class Status < ApplicationRecord validates_with DisallowedHashtagsValidator validates :reblog, uniqueness: { scope: :account }, if: :reblog? validates :visibility, exclusion: { in: %w(direct limited) }, if: :reblog? - validates :content_type, inclusion: { in: %w(text/plain text/markdown) }, allow_nil: true + validates :content_type, inclusion: { in: %w(text/plain text/markdown text/html) }, allow_nil: true accepts_nested_attributes_for :poll |