forked from AkkomaGang/akkoma
Get rid of @data in views and use separate fields.
This commit is contained in:
parent
e944a2213d
commit
41fde63def
4 changed files with 21 additions and 23 deletions
|
@ -17,22 +17,20 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
|
|||
def show_notice(%{assigns: %{notice_id: notice_id}} = conn, _params) 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
|
||||
activities =
|
||||
for a <- Enum.reverse(ActivityPub.fetch_activities_for_context(context, %{})) do
|
||||
ActivityRepresenter.prepare_activity(data.user, a)
|
||||
|> Map.put(:selected, a.object.id == data.object.id)
|
||||
end
|
||||
|
||||
render(conn, "conversation.html", data: data)
|
||||
render(conn, "conversation.html", activities: activities)
|
||||
end
|
||||
end
|
||||
|
||||
def show_user(%{assigns: %{username_or_id: username_or_id}} = conn, _params) do
|
||||
with {:ok, data} <- UserRepresenter.represent(username_or_id) do
|
||||
render(conn, "profile.html", data: data)
|
||||
end
|
||||
{:ok, data} = UserRepresenter.represent(username_or_id)
|
||||
render(conn, "profile.html", %{user: data.user, timeline: data.timeline})
|
||||
end
|
||||
|
||||
def assign_id(%{path_info: ["notice", notice_id]} = conn, _opts),
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<div class="activity" <%= if @data[:selected] do %> id="selected" <% end %>>
|
||||
<div class="activity" <%= if @selected do %> id="selected" <% end %>>
|
||||
<p class="pull-right">
|
||||
<%= link @data.published, to: @data.link, class: "activity-link" %>
|
||||
<%= link @published, to: @link, class: "activity-link" %>
|
||||
</p>
|
||||
<%= render("user_card.html", %{user: @data.user}) %>
|
||||
<%= render("user_card.html", %{user: @user}) %>
|
||||
<div class="activity-content">
|
||||
<%= if @data.title != "" do %>
|
||||
<%= if @title != "" do %>
|
||||
<details>
|
||||
<summary><%= raw @data.title %></summary>
|
||||
<div class="e-content"><%= raw @data.content %></div>
|
||||
<summary><%= raw @title %></summary>
|
||||
<div class="e-content"><%= raw @content %></div>
|
||||
</details>
|
||||
<% else %>
|
||||
<div class="e-content"><%= raw @data.content %></div>
|
||||
<div class="e-content"><%= raw @content %></div>
|
||||
<% end %>
|
||||
<%= for %{"name" => name, "url" => [url | _]} <- @data.attachment do %>
|
||||
<%= if @data.sensitive do %>
|
||||
<%= for %{"name" => name, "url" => [url | _]} <- @attachment do %>
|
||||
<%= if @sensitive do %>
|
||||
<details class="nsfw">
|
||||
<summary><%= Gettext.gettext("sensitive media") %></summary>
|
||||
<div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="conversation">
|
||||
<%= for notice <- @data do %>
|
||||
<%= render("_notice.html", %{data: notice}) %>
|
||||
<%= for activity <- @activities do %>
|
||||
<%= render("_notice.html", activity) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<h1>
|
||||
<form class="pull-right collapse" method="POST" action="<%= Helpers.util_path(@conn, :remote_subscribe) %>">
|
||||
<input type="hidden" name="nickname" value="<%= @data.user.nickname %>">
|
||||
<input type="hidden" name="nickname" value="<%= @user.nickname %>">
|
||||
<input type="hidden" name="profile" value="">
|
||||
<button type="submit" class="collapse">Remote follow</button>
|
||||
</form>
|
||||
<%= raw (@data.user.name |> Formatter.emojify(emoji_for_user(@data.user))) %>
|
||||
<%= raw (@user.name |> Formatter.emojify(emoji_for_user(@user))) %>
|
||||
</h1>
|
||||
<p><%= raw @data.user.bio %></p>
|
||||
<p><%= raw @user.bio %></p>
|
||||
<div class="activity-stream">
|
||||
<%= for activity <- @data.timeline do %>
|
||||
<%= render("_notice.html", %{data: activity}) %>
|
||||
<%= for activity <- @timeline do %>
|
||||
<%= render("_notice.html", Map.put(activity, :selected, false)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue