<% route = fn p -> ~p"/forums/#{@forum}/topics/#{@topic}?#{p}" end %> <% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, last: true) %>

<%= @topic.title %>

<%= if @topic.hidden_from_users do %>

This topic has been deleted by a moderator

Reason: <%= @topic.deletion_reason %>

<%= if can?(@conn, :hide, @topic) do %>

Deleted by: <%= link(@topic.deleted_by.name, to: ~p"/profiles/#{@topic.deleted_by}") %>

<%= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/hide", method: :delete, class: "button") do %> Restore <% end %>

<% end %>
<% end %> <% # Header section %>
<%= link(@forum.name, to: ~p"/forums/#{@forum}") %> » <%= link(@topic.title, to: ~p"/forums/#{@forum}/topics/#{@topic}") %> <%= if not @topic.hidden_from_users or can?(@conn, :hide, @topic) do %> Search Posts <% end %>
<%= if not @topic.hidden_from_users or can?(@conn, :hide, @topic) do %> <% # Display the poll, if any %> <%= if @topic.poll do %> <%= render(PhilomenaWeb.Topic.PollView, "_display.html", Map.put(assigns, :poll, @topic.poll)) %> <% end %> <% # The actual posts %>
<%= for {post, body} <- @posts, can_view_communication?(@conn, post) do %> <%= render(PhilomenaWeb.PostView, "_post.html", conn: @conn, post: post, body: body) %> <% end %> <%= if @conn.assigns.advert do %> <%= render(PhilomenaWeb.AdvertView, "_box.html", advert: @conn.assigns.advert, conn: @conn) %> <% end %> <% # Footer section %>
<%= if @topic.locked_at do %>

This topic has been locked to new posts from non-moderators.

Locked <%= pretty_time(@topic.locked_at) %>

Lock reason: <%= @topic.lock_reason %>

<%= if can?(@conn, :hide, @topic) and not is_nil(@topic.locked_by) do %>

Locked by: <%= link(@topic.locked_by.name, to: ~p"/profiles/#{@topic.locked_by}") %>

<% end %>
<% end %>
<% # Post form %> <%= cond do %> <% @conn.assigns.current_ban -> %> <%= render(PhilomenaWeb.BanView, "_ban_reason.html", conn: @conn) %> <% @topic.hidden_from_users -> %>

Cannot reply to a deleted topic.

<% @topic.post_count < 200_000 and can?(@conn, :create_post, @topic) -> %> <%= render(PhilomenaWeb.Topic.PostView, "_form.html", conn: @conn, forum: @forum, topic: @topic, changeset: @changeset) %> <% @topic.post_count >= 200_000 -> %>

Okay, we're impressed

You're looking at a thread with over 200,000 posts in it!

For various reasons, we'd like to ask you to start a new topic.

<% true -> %> <% end %> <%= if can?(@conn, :hide, @topic) do %>

<%= if not @topic.hidden_from_users do %> <%= if @topic.sticky do %> <%= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/stick", method: :delete, class: "button") do %> Unstick <% end %> <% else %> <%= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/stick", method: :post, class: "button") do %> Stick <% end %> <% end %> <%= if @topic.locked_at do %> <%= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/lock", method: :delete, class: "button") do %> Unlock <% end %> <% else %> <%= form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/lock", [method: :post, class: "hform"], fn f -> %>

<%= text_input(f, :lock_reason, class: "input hform__text", placeholder: "Lock reason", required: true) %> <%= submit class: "hform__button button" do %> Lock <% end %>
<% end %> <% end %> <%= form_for @topic_changeset, ~p"/forums/#{@forum}/topics/#{@topic}", [method: :put, class: "hform"], fn f -> %>
<%= text_input(f, :title, class: "input hform__text", placeholder: "New Title") %> <%= submit class: "hform__button button" do %> Set Title <% end %>
<% end %> <%= form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/move", [method: :post, class: "hform"], fn f -> %>
<%= select(f, :target_forum_id, Enum.map(@conn.assigns.forums, &{&1.name, &1.id}), class: "input hform__text") %> <%= submit class: "hform__button button" do %> Move <% end %>
<% end %> <%= form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/hide", [method: :post, class: "hform"], fn f -> %>
<%= text_input(f, :deletion_reason, class: "input hform__text", placeholder: "Deletion reason", required: true) %> <%= submit class: "hform__button button" do %> Delete <% end %>
<% end %> <% else %> Moderation tools unavailable for deleted topics. <% end %>

<% end %> <% end %>