Mercurial > rsstweet
annotate app/helpers/application_helper.rb @ 238:a04b4830eef2 legit-client
Filter out non-own tweets included for replies
author | nanaya <me@nanaya.net> |
---|---|
date | Sat, 15 Jul 2023 01:53:05 +0900 |
parents | 7a773720d81f |
children | 3ac13a9e593d |
rev | line source |
---|---|
0 | 1 module ApplicationHelper |
150
950849c40d42
Update all the things, including rails 5.2
nanaya <me@nanaya.pro>
parents:
103
diff
changeset
|
2 include Twitter::TwitterText::Autolink |
80 | 3 |
94 | 4 def atom_id(id) |
175
52252ae4b580
Static tag because it's supposed to be the same across rsstweet installs
nanaya <me@nanaya.pro>
parents:
172
diff
changeset
|
5 "tag:rsstweet@nanaya.pro,2014:#{id}" |
94 | 6 end |
98 | 7 |
234 | 8 def expand_url(text, urls) |
98 | 9 text.gsub /https?:\/\/t\.co\/[A-Za-z0-9]+/ do |url| |
103
1251b3d6ec5d
Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents:
98
diff
changeset
|
10 urls[url] || url |
98 | 11 end |
12 end | |
204 | 13 |
14 def status_url(tweet) | |
234 | 15 status_url_base tweet[:user][:username], tweet[:id] |
229
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
204
diff
changeset
|
16 end |
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
204
diff
changeset
|
17 |
234 | 18 def status_url_base(username, id) |
19 "https://twitter.com/#{username.presence || '_'}/status/#{id}" | |
204 | 20 end |
0 | 21 end |