mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
FIX: handle quote rendering for external Discourse instance (#16722)
Gracefully handle quotes from an external discourse instance by stripping quote-controls and including username in the title
This commit is contained in:
@ -15,12 +15,18 @@ class QuoteComparer
|
||||
# This algorithm is far from perfect, but it follows the Discourse
|
||||
# philosophy of "catch the obvious cases, leave moderation for the
|
||||
# complicated ones"
|
||||
def missing?
|
||||
return true if @parent_post.blank?
|
||||
end
|
||||
|
||||
def modified?
|
||||
return true if @text.blank? || @parent_post.blank?
|
||||
return true if @text.blank?
|
||||
|
||||
parent_text = Nokogiri::HTML5::fragment(@parent_post.cooked).text.delete(QuoteComparer.whitespace)
|
||||
text = @text.delete(QuoteComparer.whitespace)
|
||||
if @parent_post
|
||||
parent_text = Nokogiri::HTML5::fragment(@parent_post.cooked).text.delete(QuoteComparer.whitespace)
|
||||
text = @text.delete(QuoteComparer.whitespace)
|
||||
|
||||
!parent_text.include?(text)
|
||||
!parent_text.include?(text)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user