FIX: do not replace twitter handles in URLs

This commit is contained in:
Arpit Jalan 2018-05-17 00:18:19 +05:30
parent b284464a91
commit 6cd0b7316a

View File

@ -54,14 +54,14 @@ class TwitterApi
def link_handles_in(text) def link_handles_in(text)
text.scan(/(?:^|\s)@(\w+)/).flatten.uniq.each do |handle| text.scan(/(?:^|\s)@(\w+)/).flatten.uniq.each do |handle|
text.gsub!("@#{handle}", [ text.gsub!(/(?:^|\s)@#{handle}/, [
"<a href='https://twitter.com/#{handle}' target='_blank'>", " <a href='https://twitter.com/#{handle}' target='_blank'>",
"@#{handle}", "@#{handle}",
"</a>" "</a>"
].join) ].join)
end end
text text.strip
end end
def link_hashtags_in(text) def link_hashtags_in(text)