Mercurial > rsstweet
comparison app/helpers/application_helper.rb @ 242:3ac13a9e593d legit-client
Fix wrong expanded media url
author | nanaya <me@nanaya.net> |
---|---|
date | Sat, 15 Jul 2023 21:03:39 +0900 |
parents | 7a773720d81f |
children | c6a50441a58d |
comparison
equal
deleted
inserted
replaced
241:4bca1528675e | 242:3ac13a9e593d |
---|---|
5 "tag:rsstweet@nanaya.pro,2014:#{id}" | 5 "tag:rsstweet@nanaya.pro,2014:#{id}" |
6 end | 6 end |
7 | 7 |
8 def expand_url(text, urls) | 8 def expand_url(text, urls) |
9 text.gsub /https?:\/\/t\.co\/[A-Za-z0-9]+/ do |url| | 9 text.gsub /https?:\/\/t\.co\/[A-Za-z0-9]+/ do |url| |
10 urls[url] || url | 10 expanded = urls[url] |
11 | |
12 case expanded | |
13 when nil then url | |
14 when Hash then expanded[:url] | |
15 else expanded | |
16 end | |
11 end | 17 end |
12 end | 18 end |
13 | 19 |
14 def status_url(tweet) | 20 def status_url(tweet) |
15 status_url_base tweet[:user][:username], tweet[:id] | 21 status_url_base tweet[:user][:username], tweet[:id] |