changeset 125:61414d0a367b

Less breakage
author nanaya <me@nanaya.pro>
date Wed, 23 Aug 2017 16:35:58 +0900
parents 533317c0b33d
children c9864cf35950
files app/views/tweets/_tweet.html.erb config/initializers/ext_string.rb
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/app/views/tweets/_tweet.html.erb	Tue May 02 23:50:38 2017 +0900
+++ b/app/views/tweets/_tweet.html.erb	Wed Aug 23 16:35:58 2017 +0900
@@ -8,7 +8,7 @@
   <p>
     <%# FIXME: Twitter gem doesn't support extended mode when writing this %>
     <%= auto_link(expand_url(
-          tweet.attrs[:full_text],
+          tweet.attrs[:full_text].printable,
           tweet.attrs[:entities][:urls],
           tweet.attrs[:entities][:media]
         ))
@@ -20,7 +20,7 @@
   <p>
     <%= link_to "https://twitter.com/#{tweet.user.screen_name}" do %>
       <%= image_tag tweet.user.profile_image_url_https %>
-      <%= tweet.user.name -%>
+      <%= tweet.user.name.printable -%>
     <% end %>
   </p>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/initializers/ext_string.rb	Wed Aug 23 16:35:58 2017 +0900
@@ -0,0 +1,5 @@
+class String
+  def printable
+    gsub(/[^\n[:print:]]/, '')
+  end
+end