From 80705c7a204be461a5c7a4abb8c675f4482a9cd2 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 31 May 2017 17:48:22 +0200 Subject: [PATCH] Redirect to frontend on html notice path. --- lib/pleroma/web/ostatus/ostatus_controller.ex | 10 ++++++++-- lib/pleroma/web/router.ex | 3 +-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex index fd8dcdf52..948996d01 100644 --- a/lib/pleroma/web/ostatus/ostatus_controller.ex +++ b/lib/pleroma/web/ostatus/ostatus_controller.ex @@ -47,7 +47,10 @@ def object(conn, %{"uuid" => uuid}) do with id <- o_status_url(conn, :object, uuid), %Activity{} = activity <- Activity.get_create_activity_by_object_ap_id(id), %User{} = user <- User.get_cached_by_ap_id(activity.data["actor"]) do - represent_activity(conn, activity, user) + case get_format(conn) do + "html" -> redirect(conn, to: "/notice/#{activity.id}") + _ -> represent_activity(conn, activity, user) + end end end @@ -55,7 +58,10 @@ def activity(conn, %{"uuid" => uuid}) do with id <- o_status_url(conn, :activity, uuid), %Activity{} = activity <- Activity.get_by_ap_id(id), %User{} = user <- User.get_cached_by_ap_id(activity.data["actor"]) do - represent_activity(conn, activity, user) + case get_format(conn) do + "html" -> redirect(conn, to: "/notice/#{activity.id}") + _ -> represent_activity(conn, activity, user) + end end end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 12159cffc..07c1f8028 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -70,7 +70,7 @@ def user_fetcher(username) do end pipeline :ostatus do - plug :accepts, ["xml", "atom"] + plug :accepts, ["xml", "atom", "html"] end scope "/", Pleroma.Web do @@ -97,7 +97,6 @@ def user_fetcher(username) do scope "/", Fallback do get "/*path", RedirectController, :redirector end - end defmodule Fallback.RedirectController do