UX: Strip class when link is not oneboxed due to site setting limits.
This commit is contained in:
parent
ceaf234f89
commit
56034c733a
|
@ -447,7 +447,12 @@ class CookedPostProcessor
|
||||||
skip_onebox = limit <= 0 && !map[url]
|
skip_onebox = limit <= 0 && !map[url]
|
||||||
|
|
||||||
if skip_onebox
|
if skip_onebox
|
||||||
remove_inline_onebox_loading_class(element) unless is_onebox
|
if is_onebox
|
||||||
|
element.remove_class('onebox')
|
||||||
|
else
|
||||||
|
remove_inline_onebox_loading_class(element)
|
||||||
|
end
|
||||||
|
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,10 @@ describe CookedPostProcessor do
|
||||||
"https://#{url_hostname}/t/mini-inline-onebox-support-rfc/66400"
|
"https://#{url_hostname}/t/mini-inline-onebox-support-rfc/66400"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:not_oneboxed_url) do
|
||||||
|
"https://#{url_hostname}/t/random-url"
|
||||||
|
end
|
||||||
|
|
||||||
let(:title) { 'some title' }
|
let(:title) { 'some title' }
|
||||||
|
|
||||||
let(:post) do
|
let(:post) do
|
||||||
|
@ -42,7 +46,7 @@ describe CookedPostProcessor do
|
||||||
#{url}
|
#{url}
|
||||||
This is a #{url} with path
|
This is a #{url} with path
|
||||||
|
|
||||||
https://#{url_hostname}/t/random-url
|
#{not_oneboxed_url}
|
||||||
|
|
||||||
This is a https://#{url_hostname}/t/another-random-url test
|
This is a https://#{url_hostname}/t/another-random-url test
|
||||||
This is a #{url} with path
|
This is a #{url} with path
|
||||||
|
@ -101,11 +105,17 @@ describe CookedPostProcessor do
|
||||||
without: {
|
without: {
|
||||||
class: described_class::INLINE_ONEBOX_LOADING_CSS_CLASS
|
class: described_class::INLINE_ONEBOX_LOADING_CSS_CLASS
|
||||||
},
|
},
|
||||||
text: "https://#{url_hostname}/t/another-random-url",
|
text: not_oneboxed_url,
|
||||||
count: 1
|
count: 1
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(cpp.html).to have_tag('a.onebox', count: 1)
|
expect(cpp.html).to have_tag('a',
|
||||||
|
without: {
|
||||||
|
class: 'onebox'
|
||||||
|
},
|
||||||
|
text: not_oneboxed_url,
|
||||||
|
count: 1
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue