mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
FIX: Award 'First Onebox' badge just for Oneboxed URLs. (#7974)
This commit is contained in:

committed by
Régis Hanol

parent
922c40f87c
commit
7c83d2eeb2
@ -28,7 +28,7 @@ class CookedPostProcessor
|
||||
@cooking_options = @cooking_options.symbolize_keys
|
||||
|
||||
@doc = Nokogiri::HTML::fragment(post.cook(post.raw, @cooking_options))
|
||||
@has_oneboxes = post.post_analyzer.found_oneboxes?
|
||||
@has_oneboxes = @doc.css("aside.onebox").count > 0
|
||||
@size_cache = {}
|
||||
|
||||
@disable_loading_image = !!opts[:disable_loading_image]
|
||||
@ -506,13 +506,14 @@ class CookedPostProcessor
|
||||
map[url] = true
|
||||
|
||||
if is_onebox
|
||||
@has_oneboxes = true
|
||||
|
||||
Oneboxer.onebox(url,
|
||||
onebox = Oneboxer.onebox(url,
|
||||
invalidate_oneboxes: !!@opts[:invalidate_oneboxes],
|
||||
user_id: @post&.user_id,
|
||||
category_id: @post&.topic&.category_id
|
||||
)
|
||||
|
||||
@has_oneboxes = true if onebox.present?
|
||||
onebox
|
||||
else
|
||||
process_inline_onebox(element)
|
||||
false
|
||||
|
Reference in New Issue
Block a user