Notices should show entire thread from context.
authorPhil Hagelberg <phil@hagelb.org>
Tue, 29 Oct 2019 02:47:20 +0000 (19:47 -0700)
committerPhil Hagelberg <phil@hagelb.org>
Sun, 10 Nov 2019 02:07:08 +0000 (18:07 -0800)
lib/pleroma/web/static_fe/static_fe_controller.ex
lib/pleroma/web/templates/layout/static_fe.html.eex
lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex [moved from lib/pleroma/web/templates/static_fe/static_fe/notice.html.eex with 93% similarity]
lib/pleroma/web/templates/static_fe/static_fe/conversation.html.eex [new file with mode: 0644]
lib/pleroma/web/templates/static_fe/static_fe/profile.html.eex

index 8bbd06aa9f0f75ce7bce34fccec936e12d1706c6..d2b55767d5aa3776fe3311155f09e697c5b1ad6e 100644 (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
index c1fbd89cd19160ada18f78375019d1be0669ed50..9d7ee366a3f8b5012db8962a6afc6034c1723147 100644 (file)
@@ -23,6 +23,7 @@
       }
 
       .activity {
+        padding: 1em;
         margin-bottom: 1em;
       }
 
         max-height: 800px;
       }
 
+      #selected {
+        background-color: #1b2735;
+      }
+
       a {
         color: white;
       }
similarity index 93%
rename from lib/pleroma/web/templates/static_fe/static_fe/notice.html.eex
rename to lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex
index 9a7824a326a14b99496579571f89a888b70c51c3..90b5ef67c7007b8ec7ec964406ee77dcd2653d4b 100644 (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>
diff --git a/lib/pleroma/web/templates/static_fe/static_fe/conversation.html.eex b/lib/pleroma/web/templates/static_fe/static_fe/conversation.html.eex
new file mode 100644 (file)
index 0000000..35c3c17
--- /dev/null
@@ -0,0 +1,5 @@
+<div class="conversation">
+  <%= for notice <- @data do %>
+    <%= render("_notice.html", %{data: notice}) %>
+  <% end %>
+</div>
index 47b7d5286dc11a9917ef580c27bf4087307f980f..79bf5a729b5637b14c505b3a629d987a10ba91c4 100644 (file)
@@ -8,7 +8,7 @@
 </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>