forked from AkkomaGang/akkoma
Include metadata in static FE conversations and profiles.
This commit is contained in:
parent
828259fb65
commit
bfd5d79826
2 changed files with 11 additions and 5 deletions
|
@ -9,6 +9,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
|
||||||
alias Pleroma.Object
|
alias Pleroma.Object
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
|
alias Pleroma.Web.Metadata
|
||||||
alias Pleroma.Web.Router.Helpers
|
alias Pleroma.Web.Router.Helpers
|
||||||
|
|
||||||
plug(:put_layout, :static_fe)
|
plug(:put_layout, :static_fe)
|
||||||
|
@ -63,13 +64,16 @@ def represent(%Activity{object: %Object{data: data}} = activity, selected) do
|
||||||
def show(%{assigns: %{notice_id: notice_id}} = conn, _params) do
|
def show(%{assigns: %{notice_id: notice_id}} = conn, _params) do
|
||||||
case Activity.get_by_id_with_object(notice_id) do
|
case Activity.get_by_id_with_object(notice_id) do
|
||||||
%Activity{} = activity ->
|
%Activity{} = activity ->
|
||||||
|
%User{} = user = User.get_by_ap_id(activity.object.data["actor"])
|
||||||
|
meta = Metadata.build_tags(%{activity_id: notice_id, object: activity.object, user: user})
|
||||||
|
|
||||||
timeline =
|
timeline =
|
||||||
activity.object.data["context"]
|
activity.object.data["context"]
|
||||||
|> ActivityPub.fetch_activities_for_context(%{})
|
|> ActivityPub.fetch_activities_for_context(%{})
|
||||||
|> Enum.reverse()
|
|> Enum.reverse()
|
||||||
|> Enum.map(&represent(&1, &1.object.id == activity.object.id))
|
|> Enum.map(&represent(&1, &1.object.id == activity.object.id))
|
||||||
|
|
||||||
render(conn, "conversation.html", %{activities: timeline})
|
render(conn, "conversation.html", %{activities: timeline, meta: meta})
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
conn
|
conn
|
||||||
|
@ -81,6 +85,8 @@ def show(%{assigns: %{notice_id: notice_id}} = conn, _params) do
|
||||||
def show(%{assigns: %{username_or_id: username_or_id}} = conn, params) do
|
def show(%{assigns: %{username_or_id: username_or_id}} = conn, params) do
|
||||||
case User.get_cached_by_nickname_or_id(username_or_id) do
|
case User.get_cached_by_nickname_or_id(username_or_id) do
|
||||||
%User{} = user ->
|
%User{} = user ->
|
||||||
|
meta = Metadata.build_tags(%{user: user})
|
||||||
|
|
||||||
timeline =
|
timeline =
|
||||||
ActivityPub.fetch_user_activities(user, nil, Map.take(params, @page_keys))
|
ActivityPub.fetch_user_activities(user, nil, Map.take(params, @page_keys))
|
||||||
|> Enum.map(&represent/1)
|
|> Enum.map(&represent/1)
|
||||||
|
@ -95,7 +101,8 @@ def show(%{assigns: %{username_or_id: username_or_id}} = conn, params) do
|
||||||
user: user,
|
user: user,
|
||||||
timeline: timeline,
|
timeline: timeline,
|
||||||
prev_page_id: prev_page_id,
|
prev_page_id: prev_page_id,
|
||||||
next_page_id: next_page_id
|
next_page_id: next_page_id,
|
||||||
|
meta: meta
|
||||||
})
|
})
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui" />
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui" />
|
||||||
<title>
|
<title><%= Pleroma.Config.get([:instance, :name]) %></title>
|
||||||
<%= Pleroma.Config.get([:instance, :name]) %>
|
<%= Phoenix.HTML.raw(@meta || "") %>
|
||||||
</title>
|
|
||||||
<link rel="stylesheet" href="/static/static-fe.css">
|
<link rel="stylesheet" href="/static/static-fe.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in a new issue