defmodule Pleroma.Web.StaticFE.StaticFEController do
use Pleroma.Web, :controller
+ alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.StaticFE.ActivityRepresenter
alias Pleroma.Web.StaticFE.UserRepresenter
def show_notice(conn, %{"notice_id" => notice_id}) do
with {:ok, data} <- ActivityRepresenter.represent(notice_id) do
+ context = data.object.data["context"]
+ activities = ActivityPub.fetch_activities_for_context(context, %{})
+
+ data =
+ for a <- Enum.reverse(activities) do
+ ActivityRepresenter.prepare_activity(data.user, a)
+ |> Map.put(:selected, a.object.id == data.object.id)
+ end
+
conn
|> put_layout(:static_fe)
|> put_status(200)
|> put_view(Pleroma.Web.StaticFE.StaticFEView)
- |> render("notice.html", %{data: data})
+ |> render("conversation.html", %{data: data})
else
{:error, nil} ->
conn
-<div class="activity">
- <%= render("user_card.html", %{user: @data.user}) %>
+<div class="activity" <%= if @data[:selected] do %> id="selected" <% end %>>
<p class="pull-right">
<a href="<%= @data.link %>" class="activity-link"><%= @data.published %></a></p>
+ <%= render("user_card.html", %{user: @data.user}) %>
<div class="activity-content">
<%= if @data.title != "" do %>
<details>
</h1>
<p><%= raw @data.user.bio %></p>
<div class="activity-stream">
-<%= for activity <- @data.timeline do %>
- <%= render("notice.html", %{data: activity}) %>
-<% end %>
+ <%= for activity <- @data.timeline do %>
+ <%= render("_notice.html", %{data: activity}) %>
+ <% end %>
</div>