Browse Source

Redirect to frontend on html notice path.

tags/v0.9.9
Roger Braun 7 years ago
parent
commit
80705c7a20
2 changed files with 9 additions and 4 deletions
  1. +8
    -2
      lib/pleroma/web/ostatus/ostatus_controller.ex
  2. +1
    -2
      lib/pleroma/web/router.ex

+ 8
- 2
lib/pleroma/web/ostatus/ostatus_controller.ex View File

@@ -47,7 +47,10 @@ defmodule Pleroma.Web.OStatus.OStatusController 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 @@ defmodule Pleroma.Web.OStatus.OStatusController 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



+ 1
- 2
lib/pleroma/web/router.ex View File

@@ -70,7 +70,7 @@ defmodule Pleroma.Web.Router do
end

pipeline :ostatus do
plug :accepts, ["xml", "atom"]
plug :accepts, ["xml", "atom", "html"]
end

scope "/", Pleroma.Web do
@@ -97,7 +97,6 @@ defmodule Pleroma.Web.Router do
scope "/", Fallback do
get "/*path", RedirectController, :redirector
end

end

defmodule Fallback.RedirectController do


Loading…
Cancel
Save