mirror of
https://github.com/discourse/discourse.git
synced 2025-01-23 02:11:44 +08:00
FIX: Embedded Youtube videos lacking margin at bottom
Changed the cook function arguments for yotube videos.
This commit is contained in:
parent
1a45fe94a2
commit
6832b06a80
|
@ -12,8 +12,34 @@ class PostAnalyzer
|
||||||
@found_oneboxes
|
@found_oneboxes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#to add margin between youtube links
|
||||||
|
def newlinereplace(*args)
|
||||||
|
sp = args[0].split(/\n+/)
|
||||||
|
a = 0
|
||||||
|
x = 0
|
||||||
|
replacem = []
|
||||||
|
while a<sp.length do
|
||||||
|
if sp[a].length > 0
|
||||||
|
replacem[x] =sp[a]
|
||||||
|
x+=1
|
||||||
|
end
|
||||||
|
if a!= sp.length-1
|
||||||
|
replacem[x]="\n"
|
||||||
|
x+=1
|
||||||
|
end
|
||||||
|
a+=1
|
||||||
|
end
|
||||||
|
args[0]=replacem.join()
|
||||||
|
return *args
|
||||||
|
end
|
||||||
|
|
||||||
# What we use to cook posts
|
# What we use to cook posts
|
||||||
def cook(*args)
|
def cook(*args)
|
||||||
|
yt_string = args[0]
|
||||||
|
if yt_string.include? "www.youtube"
|
||||||
|
*args = newlinereplace(*args)
|
||||||
|
end
|
||||||
|
|
||||||
cooked = PrettyText.cook(*args)
|
cooked = PrettyText.cook(*args)
|
||||||
|
|
||||||
result = Oneboxer.apply(cooked, topic_id: @topic_id) do |url, _|
|
result = Oneboxer.apply(cooked, topic_id: @topic_id) do |url, _|
|
||||||
|
@ -21,7 +47,6 @@ class PostAnalyzer
|
||||||
Oneboxer.invalidate(url) if args.last[:invalidate_oneboxes]
|
Oneboxer.invalidate(url) if args.last[:invalidate_oneboxes]
|
||||||
Oneboxer.cached_onebox(url)
|
Oneboxer.cached_onebox(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
cooked = result.to_html if result.changed?
|
cooked = result.to_html if result.changed?
|
||||||
cooked
|
cooked
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user