Remove htmlentities gem (#15958)
This commit is contained in:
parent
46e6e44076
commit
1c80304fd5
5 changed files with 9 additions and 6 deletions
1
Gemfile
1
Gemfile
|
|
@ -45,7 +45,6 @@ gem "hairtrigger", "~> 0.2.24" # HairTrigger lets you create and manage database
|
|||
gem "honeybadger", "~> 4.9" # Used for tracking application errors
|
||||
gem "honeycomb-beeline", "~> 2.8.0" # Monitoring and Observability gem
|
||||
gem "html_truncator", "~> 0.4" # Truncate an HTML string properly
|
||||
gem "htmlentities", "~> 4.3", ">= 4.3.4" # A module for encoding and decoding (X)HTML entities
|
||||
gem "httparty", "~> 0.20" # Makes http fun! Also, makes consuming restful web services dead easy
|
||||
gem "httpclient", "~> 2.8.3" # Gives something like the functionality of libwww-perl (LWP) in Ruby
|
||||
gem "i18n-js", "~> 3.9.0" # Helps with internationalization in Rails.
|
||||
|
|
|
|||
|
|
@ -360,7 +360,6 @@ GEM
|
|||
html_tokenizer (0.0.7)
|
||||
html_truncator (0.4.2)
|
||||
nokogiri (~> 1.5)
|
||||
htmlentities (4.3.4)
|
||||
http-2 (0.11.0)
|
||||
http (4.4.1)
|
||||
addressable (~> 2.3)
|
||||
|
|
@ -942,7 +941,6 @@ DEPENDENCIES
|
|||
honeybadger (~> 4.9)
|
||||
honeycomb-beeline (~> 2.8.0)
|
||||
html_truncator (~> 0.4)
|
||||
htmlentities (~> 4.3, >= 4.3.4)
|
||||
httparty (~> 0.20)
|
||||
httpclient (~> 2.8.3)
|
||||
hypershield (~> 0.2.2)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ class Comment < ApplicationRecord
|
|||
validates :positive_reactions_count, presence: true
|
||||
validates :public_reactions_count, presence: true
|
||||
validates :reactions_count, presence: true
|
||||
validates :user_id, presence: true
|
||||
validates :commentable, on: :create, presence: {
|
||||
message: lambda do |object, _data|
|
||||
"#{object.commentable_type.presence || 'item'} has been deleted."
|
||||
|
|
@ -140,7 +139,7 @@ class Comment < ApplicationRecord
|
|||
|
||||
text = ActionController::Base.helpers.strip_tags(processed_html).strip
|
||||
truncated_text = ActionController::Base.helpers.truncate(text, length: length).gsub("'", "'").gsub("&", "&")
|
||||
HTMLEntities.new.decode(truncated_text)
|
||||
Nokogiri::HTML.fragment(truncated_text).text # unescapes all HTML entities
|
||||
end
|
||||
|
||||
def video
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ RSpec.describe Comment, type: :model do
|
|||
it { is_expected.to validate_presence_of(:positive_reactions_count) }
|
||||
it { is_expected.to validate_presence_of(:public_reactions_count) }
|
||||
it { is_expected.to validate_presence_of(:reactions_count) }
|
||||
it { is_expected.to validate_presence_of(:user_id) }
|
||||
end
|
||||
|
||||
it do
|
||||
|
|
@ -329,6 +328,14 @@ RSpec.describe Comment, type: :model do
|
|||
comment.validate!
|
||||
expect(comment.title).not_to include("'")
|
||||
end
|
||||
|
||||
# NOTE: example string taken from https://github.com/threedaymonk/htmlentities
|
||||
# as this is the gem we're removing.
|
||||
it "correctly decodes HTML entities" do
|
||||
comment.body_markdown = "élan"
|
||||
comment.validate!
|
||||
expect(comment.title).to eq("élan")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#custom_css" do
|
||||
|
|
|
|||
BIN
vendor/cache/htmlentities-4.3.4.gem
vendored
BIN
vendor/cache/htmlentities-4.3.4.gem
vendored
Binary file not shown.
Loading…
Add table
Reference in a new issue