view app/views/tweets/_tweet.html.erb @ 230:e6c29d47192b

Update with non-suspended empty account (wat)
author nanaya <me@nanaya.pro>
date Thu, 28 Apr 2022 22:49:21 +0900
parents 12287b32fbda
children 7a773720d81f
line wrap: on
line source

<% if tweet.retweeted_status.present? %>
  <p>
    <%= link_to status_url(tweet.retweeted_status) do %>
      <em>Retweeted:</em>
    <% end %>
  </p>

  <%= render "tweet", :tweet => tweet.retweeted_status, :with_time => true %>
<% else%>
  <% if defined?(with_time) && with_time %>
    <p>
      <small>Originally tweeted at <%= tweet.created_at.rfc822 %></small>
    </p>
  <% end %>

  <% if tweet.in_reply_to_status_id.present? %>
    <p>
      <small>
        Replying to
        <%= link_to 'tweet', status_url_base(tweet.in_reply_to_screen_name, tweet.in_reply_to_status_id) %>
        by <%= link_to tweet.in_reply_to_screen_name, "https://twitter.com/#{tweet.in_reply_to_screen_name}" %>
      </small>
    </p>
  <% end %>

  <p>
    <%# FIXME: Twitter gem doesn't support extended mode when writing this %>
    <%= auto_link(expand_url(
          tweet.full_text_extended,
          tweet.attrs[:entities][:urls],
          tweet.attrs[:entities][:media]
        ))
        .gsub("\n", "<br />")
        .html_safe
      %>
  </p>

  <p>
    <%= link_to "https://twitter.com/#{tweet.user.screen_name}" do %>
      <%= image_tag tweet.user.profile_image_url_https.to_s, :alt => "profile image for #{tweet.user.name.printable}" %>
      <%= tweet.user.name.printable -%>
    <% end %>
  </p>

  <p>
    <% tweet.media.each_with_index do |media, i| %>
      <% if media.is_a? Twitter::Media::Photo %>
        <%= link_to "#{media.media_url_https}?name=orig" do %>
          <%= image_tag "#{media.media_url_https}?name=small", :alt => "attachment #{i + 1}" -%>
        <% end %>
      <% elsif media.is_a? Twitter::Media::Video %>
        <%= video_tag media.video_info.variants
          .select { |i| i.bitrate.is_a? Integer }
          .sort_by { |i| -i.bitrate }
          .map(&:url), width: '100%', controls: true
        %>
      <% end %>
    <% end %>
  </p>

  <% if tweet.quoted_status.present? %>
    <blockquote>
      <%= render "tweet", :tweet => tweet.quoted_status, :with_time => true %>
    </blockquote>
  <% end %>
<% end %>