mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 22:35:03 +08:00
FIX: Do not check for duplicate links in Onebox (#13345)
If a user posted a URL that appeared inside a Onebox, then the user got a duplicate link notice. This was fixed by skipping those links in Ruby. If a user posted a URL that was Oneboxes and contained other links that appeared in previous posts, then the user got a duplicate link notice. This was fixed by skipping those links in JavaScript.
This commit is contained in:
@ -324,8 +324,11 @@ module PrettyText
|
||||
links = []
|
||||
doc = Nokogiri::HTML5.fragment(html)
|
||||
|
||||
# remove href inside quotes & elided part
|
||||
doc.css("aside.quote a, .elided a").each { |a| a["href"] = "" }
|
||||
# extract onebox links
|
||||
doc.css("aside.onebox[data-onebox-src]").each { |onebox| links << DetectedLink.new(onebox["data-onebox-src"], false) }
|
||||
|
||||
# remove href inside quotes & oneboxes & elided part
|
||||
doc.css("aside.quote a, aside.onebox a, .elided a").remove
|
||||
|
||||
# extract all links
|
||||
doc.css("a").each do |a|
|
||||
|
Reference in New Issue
Block a user