annotate app/views/tweets/_tweet.html.erb @ 241:4bca1528675e legit-client

Wrong entity lookup key
author nanaya <me@nanaya.net>
date Sat, 15 Jul 2023 17:06:21 +0900
parents 961d362e42c7
children be0b78fb5f57
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
1 <% if tweet[:retweet].present? %>
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
2 <p>
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
3 <%= link_to status_url(tweet[:retweet]) do %>
190
7b1bdf697063 Add direct link for retweet
nanaya <me@nanaya.pro>
parents: 178
diff changeset
4 <em>Retweeted:</em>
7b1bdf697063 Add direct link for retweet
nanaya <me@nanaya.pro>
parents: 178
diff changeset
5 <% end %>
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
6 </p>
62
9ab79a764434 Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff changeset
7
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
8 <%= render "tweet", :tweet => tweet[:retweet], :with_time => true %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
9 <% else %>
132
bedb7e2e16ed Oh whoops
nanaya <me@nanaya.pro>
parents: 131
diff changeset
10 <% if defined?(with_time) && with_time %>
131
4b5568b4a533 Also add time for quotes
nanaya <me@nanaya.pro>
parents: 130
diff changeset
11 <p>
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
12 <small>Originally tweeted at <%= tweet[:created_at].rfc822 %></small>
131
4b5568b4a533 Also add time for quotes
nanaya <me@nanaya.pro>
parents: 130
diff changeset
13 </p>
4b5568b4a533 Also add time for quotes
nanaya <me@nanaya.pro>
parents: 130
diff changeset
14 <% end %>
4b5568b4a533 Also add time for quotes
nanaya <me@nanaya.pro>
parents: 130
diff changeset
15
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
16 <% if tweet[:reply_to_id].present? %>
229
12287b32fbda Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents: 223
diff changeset
17 <p>
12287b32fbda Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents: 223
diff changeset
18 <small>
12287b32fbda Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents: 223
diff changeset
19 Replying to
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
20 <%= link_to 'tweet', status_url_base(tweet[:reply_to_username], tweet[:reply_to_id]) %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
21 by <%= link_to "@#{tweet[:reply_to_username]}", "https://twitter.com/#{tweet[:reply_to_username]}" %>
229
12287b32fbda Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents: 223
diff changeset
22 </small>
12287b32fbda Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents: 223
diff changeset
23 </p>
12287b32fbda Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents: 223
diff changeset
24 <% end %>
12287b32fbda Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents: 223
diff changeset
25
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
26 <p>
174
d35dbc09bd83 Less double escaping for actual content
nanaya <me@nanaya.pro>
parents: 172
diff changeset
27 <%= auto_link(expand_url(
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
28 tweet[:message],
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
29 { **tweet[:entity_urls], **tweet[:entity_media] }
174
d35dbc09bd83 Less double escaping for actual content
nanaya <me@nanaya.pro>
parents: 172
diff changeset
30 ))
169
04ca6c4f11d0 xhtml compliance
nanaya <me@nanaya.pro>
parents: 167
diff changeset
31 .gsub("\n", "<br />")
103
1251b3d6ec5d Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents: 100
diff changeset
32 .html_safe
1251b3d6ec5d Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents: 100
diff changeset
33 %>
79
04ccd0632a71 Move user info to bottom
nanaya <me@myconan.net>
parents: 75
diff changeset
34 </p>
04ccd0632a71 Move user info to bottom
nanaya <me@myconan.net>
parents: 75
diff changeset
35
04ccd0632a71 Move user info to bottom
nanaya <me@myconan.net>
parents: 75
diff changeset
36 <p>
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
37 <%= link_to "https://twitter.com/#{tweet[:user][:username]}" do %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
38 <%= image_tag tweet[:user][:avatar_url].to_s, :alt => "profile image for #{tweet[:user][:name].printable}" %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
39 <%= tweet[:user][:name].printable -%>
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
40 <% end %>
75
585952f98978 Put the tweet on different paragraph
nanaya <me@myconan.net>
parents: 65
diff changeset
41 </p>
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
42
75
585952f98978 Put the tweet on different paragraph
nanaya <me@myconan.net>
parents: 65
diff changeset
43 <p>
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
44 <% tweet[:entity_media].each do |_short_url, media| %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
45 <% if media[:type] == 'photo' %>
237
961d362e42c7 The url in entity media isn't unique as they all point to the same thing
nanaya <me@nanaya.net>
parents: 234
diff changeset
46 <%= link_to "#{media[:image_url]}?name=orig" do %>
961d362e42c7 The url in entity media isn't unique as they all point to the same thing
nanaya <me@nanaya.net>
parents: 234
diff changeset
47 <%= image_tag "#{media[:image_url]}?name=small", :alt => "attachment #{media[:id]}" -%>
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
48 <% end %>
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
49 <% elsif media[:type] == 'video' %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
50 <%= video_tag media[:variants]
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
51 .sort_by { |variant| -variant[:bitrate] }
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
52 .map { |variant| variant[:url] }, width: '100%', controls: true
178
38598ae5a8f6 Sort video url by bitrate
nanaya <me@nanaya.pro>
parents: 174
diff changeset
53 %>
62
9ab79a764434 Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff changeset
54 <% end %>
9ab79a764434 Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff changeset
55 <% end %>
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
56 </p>
62
9ab79a764434 Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff changeset
57
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
58 <% if tweet[:quote_id].present? %>
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
59 <blockquote>
234
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
60 <% if tweet[:quote].present? %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
61 <%= render "tweet", :tweet => tweet[:quote], :with_time => true %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
62 <% else %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
63 <%= link_to status_url_base(nil, tweet[:quote_id]) do %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
64 <em>Preview not available, view tweet directly.</em>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
65 <% end %>
7a773720d81f Totally legit client
nanaya <me@nanaya.net>
parents: 229
diff changeset
66 <% end %>
64
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
67 </blockquote>
a20bbd1e2dc1 Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents: 62
diff changeset
68 <% end %>
62
9ab79a764434 Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff changeset
69 <% end %>