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 defmodule Pleroma.Web.StaticFE.StaticFEController do
use Pleroma.Web, :controller use Pleroma.Web, :controller
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.StaticFE.ActivityRepresenter alias Pleroma.Web.StaticFE.ActivityRepresenter
alias Pleroma.Web.StaticFE.UserRepresenter alias Pleroma.Web.StaticFE.UserRepresenter
@ -12,11 +13,20 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
def show_notice(conn, %{"notice_id" => notice_id}) do def show_notice(conn, %{"notice_id" => notice_id}) do
with {:ok, data} <- ActivityRepresenter.represent(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 conn
|> put_layout(:static_fe) |> put_layout(:static_fe)
|> put_status(200) |> put_status(200)
|> put_view(Pleroma.Web.StaticFE.StaticFEView) |> put_view(Pleroma.Web.StaticFE.StaticFEView)
|> render("notice.html", %{data: data}) |> render("conversation.html", %{data: data})
else else
{:error, nil} -> {:error, nil} ->
conn conn

View file

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

View file

@ -1,7 +1,7 @@
<div class="activity"> <div class="activity" <%= if @data[:selected] do %> id="selected" <% end %>>
<%= render("user_card.html", %{user: @data.user}) %>
<p class="pull-right"> <p class="pull-right">
<a href="<%= @data.link %>" class="activity-link"><%= @data.published %></a></p> <a href="<%= @data.link %>" class="activity-link"><%= @data.published %></a></p>
<%= render("user_card.html", %{user: @data.user}) %>
<div class="activity-content"> <div class="activity-content">
<%= if @data.title != "" do %> <%= if @data.title != "" do %>
<details> <details>

View file

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

View file

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