Add support for HTML-formatted toots
This commit is contained in:
		
							parent
							
								
									94aef563b9
								
							
						
					
					
						commit
						d7520f8175
					
				@ -37,9 +37,9 @@ class Formatter
 | 
				
			|||||||
    html = raw_content
 | 
					    html = raw_content
 | 
				
			||||||
    html = "RT @#{prepend_reblog} #{html}" if prepend_reblog
 | 
					    html = "RT @#{prepend_reblog} #{html}" if prepend_reblog
 | 
				
			||||||
    html = format_markdown(html) if status.content_type == 'text/markdown'
 | 
					    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 = 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.delete("\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    html.html_safe # rubocop:disable Rails/OutputSafety
 | 
					    html.html_safe # rubocop:disable Rails/OutputSafety
 | 
				
			||||||
 | 
				
			|||||||
@ -75,7 +75,7 @@ class Status < ApplicationRecord
 | 
				
			|||||||
  validates_with DisallowedHashtagsValidator
 | 
					  validates_with DisallowedHashtagsValidator
 | 
				
			||||||
  validates :reblog, uniqueness: { scope: :account }, if: :reblog?
 | 
					  validates :reblog, uniqueness: { scope: :account }, if: :reblog?
 | 
				
			||||||
  validates :visibility, exclusion: { in: %w(direct limited) }, 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
 | 
					  accepts_nested_attributes_for :poll
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user