Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to twitter-text 2+ #66

Merged
merged 1 commit into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/sir_trevor_rails/blocks/tweet_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TweetBlock < SirTrevorRails::Block
include ActionView::Helpers::SanitizeHelper

def render_tweet_body
sanitize Twitter::Autolink.auto_link(
sanitize Twitter::TwitterText::Autolink.auto_link(
self.text,
url_entities: (self.entities.values_at(:urls, :media).flatten.compact.uniq rescue nil)
), tags: %w{a span}, attributes: %w{class href rel target}
Expand All @@ -28,7 +28,7 @@ def at_name
def profile_image_url
# TODO: add support for different size images: https://dev.twitter.com/overview/general/user-profile-images-and-banners

# Split the URL to omit the protocol and let the browser define the context (note: assumes asset is available over both HTTP and HTTPS)
# Split the URL to omit the protocol and let the browser define the context (note: assumes asset is available over both HTTP and HTTPS)
"//" << self.user[:profile_image_url].split("://")[1]
end

Expand Down
2 changes: 1 addition & 1 deletion sir_trevor_rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ Gem::Specification.new do |spec|

spec.add_dependency "rails", ">= 3", "< 7"
spec.add_dependency "redcarpet", ">= 2.0.1", "< 4"
spec.add_dependency "twitter-text", "~> 1.4"
spec.add_dependency "twitter-text", ">= 2.0.1", "< 4"
spec.add_dependency 'multi_json', '~> 1.0'
end