Add header to profile/notice pages linking to pleroma-fe.

This commit is contained in:
Phil Hagelberg 2019-10-29 20:55:43 -07:00
parent 33a26b61c3
commit 918e1353f6
5 changed files with 11 additions and 5 deletions

View file

@ -43,6 +43,7 @@ def represent(%Activity{} = activity, selected) do
end end
def show_notice(%{assigns: %{notice_id: notice_id}} = conn, _params) do def show_notice(%{assigns: %{notice_id: notice_id}} = conn, _params) do
instance_name = Pleroma.Config.get([:instance, :name], "Pleroma")
activity = Activity.get_by_id_with_object(notice_id) activity = Activity.get_by_id_with_object(notice_id)
context = activity.object.data["context"] context = activity.object.data["context"]
activities = ActivityPub.fetch_activities_for_context(context, %{}) activities = ActivityPub.fetch_activities_for_context(context, %{})
@ -52,10 +53,11 @@ def show_notice(%{assigns: %{notice_id: notice_id}} = conn, _params) do
represent(activity, a.object.id == activity.object.id) represent(activity, a.object.id == activity.object.id)
end end
render(conn, "conversation.html", activities: represented) render(conn, "conversation.html", %{activities: represented, instance_name: instance_name})
end end
def show_user(%{assigns: %{username_or_id: username_or_id}} = conn, _params) do def show_user(%{assigns: %{username_or_id: username_or_id}} = conn, _params) do
instance_name = Pleroma.Config.get([:instance, :name], "Pleroma")
%User{} = user = User.get_cached_by_nickname_or_id(username_or_id) %User{} = user = User.get_cached_by_nickname_or_id(username_or_id)
timeline = timeline =
@ -63,7 +65,7 @@ def show_user(%{assigns: %{username_or_id: username_or_id}} = conn, _params) do
represent(activity, user, false) represent(activity, user, false)
end end
render(conn, "profile.html", %{user: user, timeline: timeline}) render(conn, "profile.html", %{user: user, timeline: timeline, instance_name: instance_name})
end end
def assign_id(%{path_info: ["notice", notice_id]} = conn, _opts), def assign_id(%{path_info: ["notice", notice_id]} = conn, _opts),

View file

@ -2,7 +2,7 @@
<p class="pull-right"> <p class="pull-right">
<%= link @published, to: @link, class: "activity-link" %> <%= link @published, to: @link, class: "activity-link" %>
</p> </p>
<%= render("user_card.html", %{user: @user}) %> <%= render("_user_card.html", %{user: @user}) %>
<div class="activity-content"> <div class="activity-content">
<%= if @title != "" do %> <%= if @title != "" do %>
<details> <details>

View file

@ -1,3 +1,5 @@
<h1><%= link @instance_name, to: "/" %></h1>
<div class="conversation"> <div class="conversation">
<%= for activity <- @activities do %> <%= for activity <- @activities do %>
<%= render("_notice.html", activity) %> <%= render("_notice.html", activity) %>

View file

@ -1,11 +1,13 @@
<h1> <h1><%= link @instance_name, to: "/" %></h1>
<h3>
<form class="pull-right collapse" method="POST" action="<%= Helpers.util_path(@conn, :remote_subscribe) %>"> <form class="pull-right collapse" method="POST" action="<%= Helpers.util_path(@conn, :remote_subscribe) %>">
<input type="hidden" name="nickname" value="<%= @user.nickname %>"> <input type="hidden" name="nickname" value="<%= @user.nickname %>">
<input type="hidden" name="profile" value=""> <input type="hidden" name="profile" value="">
<button type="submit" class="collapse">Remote follow</button> <button type="submit" class="collapse">Remote follow</button>
</form> </form>
<%= raw (@user.name |> Formatter.emojify(emoji_for_user(@user))) %> <%= raw (@user.name |> Formatter.emojify(emoji_for_user(@user))) %>
</h1> </h3>
<p><%= raw @user.bio %></p> <p><%= raw @user.bio %></p>
<div class="activity-stream"> <div class="activity-stream">
<%= for activity <- @timeline do %> <%= for activity <- @timeline do %>