diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rb index 085c6c19adb..40d1d41d18b 100644 --- a/app/services/post_alerter.rb +++ b/app/services/post_alerter.rb @@ -429,7 +429,7 @@ class PostAlerter post_number: post.post_number, topic_title: post.topic.title, topic_id: post.topic.id, - excerpt: excerpt || post.excerpt(400, text_entities: true, strip_links: true, remap_emoji: true, strip_spoilers: true), + excerpt: excerpt || post.excerpt(400, text_entities: true, strip_links: true, remap_emoji: true), username: username || post.username, post_url: post_url } diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index a2b27f1007c..530546f9c85 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -347,7 +347,6 @@ en: revert_version_same: "The current version is same as the version you are trying to revert to." excerpt_image: "image" - excerpt_spoiler: "spoiler" groups: success: @@ -4269,7 +4268,7 @@ en: label: "Private" description: "Only logged in users can access this community" invite_only: - placeholder: "People must be explicitly invited. Public registration is disabled." + placeholder: "People must be explicitly invited. Public registration is disabled." contact: title: "Contact" diff --git a/lib/excerpt_parser.rb b/lib/excerpt_parser.rb index 5d2c5fe27a8..96400ade31c 100644 --- a/lib/excerpt_parser.rb +++ b/lib/excerpt_parser.rb @@ -17,7 +17,6 @@ class ExcerptParser < Nokogiri::XML::SAX::Document @keep_emoji_images = options[:keep_emoji_images] == true @keep_onebox_source = options[:keep_onebox_source] == true @remap_emoji = options[:remap_emoji] == true - @strip_spoilers = options[:strip_spoilers] == true @start_excerpt = false @in_details_depth = 0 @summary_contents = "" @@ -111,11 +110,7 @@ class ExcerptParser < Nokogiri::XML::SAX::Document end # Preserve spoilers if attributes.include?(["class", "spoiler"]) - if @strip_spoilers - characters("[#{I18n.t 'excerpt_spoiler'}]") - else - include_tag("span", attributes) - end + include_tag("span", attributes) @in_spoiler = true end @@ -199,8 +194,6 @@ class ExcerptParser < Nokogiri::XML::SAX::Document @excerpt << before_string if before_string - string = "" if @in_spoiler && @strip_spoilers - encode = encode ? lambda { |s| ERB::Util.html_escape(s) } : lambda { |s| s } if count_it && @current_length + string.length > @length length = [0, @length - @current_length - 1].max diff --git a/spec/components/excerpt_parser_spec.rb b/spec/components/excerpt_parser_spec.rb index f3cba94e448..8410b9d5e45 100644 --- a/spec/components/excerpt_parser_spec.rb +++ b/spec/components/excerpt_parser_spec.rb @@ -32,14 +32,4 @@ describe ExcerptParser do expect(ExcerptParser.get_excerpt(html, 3, {})).to match_html('
foo
') expect(ExcerptParser.get_excerpt(html, 2, {})).to match_html('
fo…
') end - - it "preserves spoilers by default" do - html = 'Foo bar' - expect(ExcerptParser.get_excerpt(html, 100, {})).to match_html('Foo bar') - end - - it "strips spoilers when specified" do - html = 'Foo bar' - expect(ExcerptParser.get_excerpt(html, 100, strip_spoilers: true)).to match_html("Foo [#{I18n.t 'excerpt_spoiler'}]") - end end