diff --git a/lib/pleroma/web/static_fe/activity_representer.ex b/lib/pleroma/web/static_fe/activity_representer.ex
index 93f8a8813..9c4315610 100644
--- a/lib/pleroma/web/static_fe/activity_representer.ex
+++ b/lib/pleroma/web/static_fe/activity_representer.ex
@@ -17,6 +17,9 @@ defmodule Pleroma.Web.StaticFE.ActivityRepresenter do
|> set_attachments(object)
end
+ def prepare_activity(%User{} = user, %Activity{} = activity), do:
+ prepare_activity(user, Object.normalize(activity.data["object"]))
+
defp set_user(data, %User{} = user), do: Map.put(data, :user, user)
defp set_object(data, %Object{} = object), do: Map.put(data, :object, object)
diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex
index 7d7cb6ddd..78cd325c8 100644
--- a/lib/pleroma/web/static_fe/static_fe_controller.ex
+++ b/lib/pleroma/web/static_fe/static_fe_controller.ex
@@ -6,6 +6,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
use Pleroma.Web, :controller
alias Pleroma.Web.StaticFE.ActivityRepresenter
+ alias Pleroma.Web.StaticFE.UserRepresenter
require Logger
@@ -15,7 +16,22 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
|> put_layout(:static_fe)
|> put_status(200)
|> put_view(Pleroma.Web.StaticFE.StaticFEView)
- |> render("notice.html", data)
+ |> render("notice.html", %{data: data})
+ else
+ _ ->
+ conn
+ |> put_status(404)
+ |> text("Not found")
+ end
+ end
+
+ def show_user(conn, %{"username_or_id" => username_or_id}) do
+ with {:ok, data} <- UserRepresenter.represent(username_or_id) do
+ conn
+ |> put_layout(:static_fe)
+ |> put_status(200)
+ |> put_view(Pleroma.Web.StaticFE.StaticFEView)
+ |> render("profile.html", %{data: data})
else
_ ->
conn
@@ -27,6 +43,12 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
def show(%{path_info: ["notice", notice_id]} = conn, _params),
do: show_notice(conn, %{"notice_id" => notice_id})
+ def show(%{path_info: ["users", user_id]} = conn, _params),
+ do: show_user(conn, %{"username_or_id" => user_id})
+
+ def show(%{path_info: [user_id]} = conn, _params),
+ do: show_user(conn, %{"username_or_id" => user_id})
+
# Fallback for unhandled types
def show(conn, _params) do
conn
diff --git a/lib/pleroma/web/static_fe/static_fe_view.ex b/lib/pleroma/web/static_fe/static_fe_view.ex
index 7f58e1b2d..71e47d2c1 100644
--- a/lib/pleroma/web/static_fe/static_fe_view.ex
+++ b/lib/pleroma/web/static_fe/static_fe_view.ex
@@ -9,6 +9,8 @@ defmodule Pleroma.Web.StaticFE.StaticFEView do
alias Pleroma.Web.MediaProxy
alias Pleroma.Formatter
+ import Phoenix.HTML
+
def emoji_for_user(%User{} = user) do
(user.info.source_data["tag"] || [])
|> Enum.filter(fn %{"type" => t} -> t == "Emoji" end)
diff --git a/lib/pleroma/web/static_fe/user_representer.ex b/lib/pleroma/web/static_fe/user_representer.ex
new file mode 100644
index 000000000..9d2f1eb85
--- /dev/null
+++ b/lib/pleroma/web/static_fe/user_representer.ex
@@ -0,0 +1,35 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors
<%= raw @data.user.bio %>
+