A platform for community discussion. Free, open, simple.
UX: Strip class when link is not oneboxed due to site setting limits.
Guo Xiang Tan56034c733a59
diff --git a/lib/cooked_post_processor.rb b/lib/cooked_post_processor.rbindex 8e8199ca430..ace18156c4a 100644--- a/lib/cooked_post_processor.rb+++ b/lib/cooked_post_processor.rb@@ -447,7 +447,12 @@ class CookedPostProcessorskip_onebox = limit <= 0 && !map[url]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+nextenddiff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rbindex 83d6714bfe8..7990b39fad6 100644--- a/spec/components/cooked_post_processor_spec.rb+++ b/spec/components/cooked_post_processor_spec.rb@@ -35,6 +35,10 @@ describe CookedPostProcessor do"https://#{url_hostname}/t/mini-inline-onebox-support-rfc/66400"end+ let(:not_oneboxed_url) do+ "https://#{url_hostname}/t/random-url"+ end+let(:title) { 'some title' }let(:post) do@@ -42,7 +46,7 @@ describe CookedPostProcessor do#{url}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 testThis is a #{url} with path@@ -101,11 +105,17 @@ describe CookedPostProcessor dowithout: {class: described_class::INLINE_ONEBOX_LOADING_CSS_CLASS},- text: "https://#{url_hostname}/t/another-random-url",+ text: not_oneboxed_url,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+ )endend