Notices should show entire thread from context.

This commit is contained in:
Phil Hagelberg 2019-10-28 19:47:20 -07:00
parent 748d800acb
commit cc1b07132f
5 changed files with 26 additions and 6 deletions

View file

@ -5,6 +5,7 @@
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
@ -12,11 +13,20 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
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

View file

@ -23,6 +23,7 @@
}
.activity {
padding: 1em;
margin-bottom: 1em;
}
@ -41,6 +42,10 @@
max-height: 800px;
}
#selected {
background-color: #1b2735;
}
a {
color: white;
}

View file

@ -1,7 +1,7 @@
<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>

View file

@ -0,0 +1,5 @@
<div class="conversation">
<%= for notice <- @data do %>
<%= render("_notice.html", %{data: notice}) %>
<% end %>
</div>

View file

@ -9,6 +9,6 @@
<p><%= raw @data.user.bio %></p>
<div class="activity-stream">
<%= for activity <- @data.timeline do %>
<%= render("notice.html", %{data: activity}) %>
<%= render("_notice.html", %{data: activity}) %>
<% end %>
</div>