Merge branch 'authenticated-profile-fetching' into 'develop'

Allow profile fetching for authenticated users only.

Closes #54

See merge request pleroma/pleroma!7
This commit is contained in:
lambda 2017-11-07 18:58:22 +00:00
commit d761b1543a
2 changed files with 6 additions and 3 deletions

View File

@ -138,7 +138,6 @@ defmodule Pleroma.Web.Router do
get "/search", TwitterAPI.Controller, :search get "/search", TwitterAPI.Controller, :search
get "/statusnet/tags/timeline/:tag", TwitterAPI.Controller, :public_and_external_timeline get "/statusnet/tags/timeline/:tag", TwitterAPI.Controller, :public_and_external_timeline
get "/externalprofile/show", TwitterAPI.Controller, :external_profile
end end
scope "/api", Pleroma.Web do scope "/api", Pleroma.Web do
@ -176,6 +175,8 @@ defmodule Pleroma.Web.Router do
get "/statuses/followers", TwitterAPI.Controller, :followers get "/statuses/followers", TwitterAPI.Controller, :followers
get "/statuses/friends", TwitterAPI.Controller, :friends get "/statuses/friends", TwitterAPI.Controller, :friends
get "/externalprofile/show", TwitterAPI.Controller, :external_profile
end end
pipeline :ostatus do pipeline :ostatus do

View File

@ -405,11 +405,13 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
describe "GET /api/externalprofile/show" do describe "GET /api/externalprofile/show" do
test "it returns the user", %{conn: conn} do test "it returns the user", %{conn: conn} do
user = insert(:user) user = insert(:user)
other_user = insert(:user)
conn = conn conn = conn
|> get("/api/externalprofile/show", %{profileurl: user.ap_id}) |> assign(:user, user)
|> get("/api/externalprofile/show", %{profileurl: other_user.ap_id})
assert json_response(conn, 200) == UserView.render("show.json", %{user: user}) assert json_response(conn, 200) == UserView.render("show.json", %{user: other_user})
end end
end end