Mercurial > rsstweet
changeset 204:70e90ea4b870
Fix uri for nil user
author | nanaya <me@nanaya.pro> |
---|---|
date | Mon, 19 Oct 2020 04:08:30 +0900 |
parents | af84c9f23263 |
children | 8190fa511e35 |
files | app/helpers/application_helper.rb app/views/tweets/_tweet.atom.erb app/views/tweets/_tweet.html.erb |
diffstat | 3 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/app/helpers/application_helper.rb Mon Oct 19 03:42:22 2020 +0900 +++ b/app/helpers/application_helper.rb Mon Oct 19 04:08:30 2020 +0900 @@ -20,4 +20,8 @@ urls[url] || url end end + + def status_url(tweet) + "https://twitter.com/#{tweet.user.screen_name.presence || '_'}/status/#{tweet.id}" + end end
--- a/app/views/tweets/_tweet.atom.erb Mon Oct 19 03:42:22 2020 +0900 +++ b/app/views/tweets/_tweet.atom.erb Mon Oct 19 04:08:30 2020 +0900 @@ -2,7 +2,7 @@ <id><%= atom_id "#{tweet.user.id}/#{tweet.id}" %></id> <published><%= tweet.created_at.xmlschema %></published> <updated><%= tweet.created_at.xmlschema %></updated> - <link rel="alternate" type="text/html" href="<%= tweet.uri %>"/> + <link rel="alternate" type="text/html" href="<%= status_url(tweet) %>"/> <title><%= truncate tweet.unescaped_text, :length => 30 %></title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">
--- a/app/views/tweets/_tweet.html.erb Mon Oct 19 03:42:22 2020 +0900 +++ b/app/views/tweets/_tweet.html.erb Mon Oct 19 04:08:30 2020 +0900 @@ -1,6 +1,6 @@ <% if tweet.retweeted_status.present? %> <p> - <%= link_to tweet.retweeted_status.uri.to_s do %> + <%= link_to status_url(tweet.retweeted_status) do %> <em>Retweeted:</em> <% end %> </p>