philomena/lib/philomena_web/templates/conversation/show.html.heex
2024-06-01 23:50:49 -04:00

84 lines
3.3 KiB
Text

<% route = fn p -> ~p"/conversations/#{@conversation}?#{p}" end
pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @messages, route: route, conn: @conn)
other = other_party(@current_user, @conversation) %>
<h1>
<%= @conversation.title %>
</h1>
<div class="block">
<div class="block__header">
<%= link("Message Center", to: ~p"/conversations") %> &raquo; <%= link(@conversation.title, to: ~p"/conversations/#{@conversation}") %> Conversation with <%= render(PhilomenaWeb.UserAttributionView, "_user.html", object: %{user: other}, conn: @conn) %>
</div>
<div class="block__header--sub block__header--light page__header">
<span class="block__header__title page__title">
<%= @messages.total_entries %>
<%= pluralize("message", "messages", @messages.total_entries) %>
</span>
<div class="page__pagination">
<%= pagination %>
</div>
<div class="page__info">
<%= if hidden_by?(@current_user, @conversation) do %>
<%= link("Restore conversation", to: ~p"/conversations/#{@conversation}/hide", data: [method: "delete"]) %>
<% else %>
<%= link("Remove conversation", to: ~p"/conversations/#{@conversation}/hide", data: [method: "post", confirm: "Are you really, really sure?"]) %>
<% end %>
<%= link("Report conversation", to: ~p"/conversations/#{@conversation}/reports/new") %>
<%= link("Mark as unread", to: ~p"/conversations/#{@conversation}/read", data: [method: "delete"]) %>
</div>
</div>
</div>
<%= for {message, body} <- @messages do %>
<%= render(PhilomenaWeb.MessageView, "_message.html", message: message, body: body, conn: @conn) %>
<% end %>
<div class="block">
<div class="block__header block__header--light page__header">
<div class="page__pagination">
<%= pagination %>
</div>
</div>
</div>
<%= case DateTime.compare(DateTime.utc_now(), DateTime.add(@conn.assigns.current_user.created_at, 1_209_600)) do %>
<% :lt -> %>
<div class="block block--fixed block--warning hidden js-hidden-warning">
<h2>
Warning!
</h2>
<p>
<strong>
Your account is too new, so your PM will need to be reviewed by staff members.
</strong>
This is because it contains an external image. If you are not okay with a moderator viewing this PM conversation, please consider linking the image instead of embedding it (change
<code>
![
</code>
to
<code>
[
</code>
).
</p>
</div>
<% _ -> %>
<% # Nothing %>
<% end %>
<%= cond do %>
<% @conn.assigns.current_ban -> %>
<%= render(PhilomenaWeb.BanView, "_ban_reason.html", conn: @conn) %>
<% @messages.total_entries < 1_000 -> %>
<%= render(PhilomenaWeb.Conversation.MessageView, "_form.html", conversation: @conversation, changeset: @changeset, conn: @conn) %>
<% true -> %>
<div>
<h2>
Okay, we're impressed
</h2>
<p>
You've managed to send over 1,000 messages in this conversation!
</p>
<p>
We'd like to ask you to make a new conversation. Don't worry, this one won't go anywhere if you need to refer back to it.
</p>
<p>
<%= link("Click here", to: ~p"/conversations/new?#{[receipient: other.name]}") %> to make a new conversation with this user.
</p>
</div>
<% end %>