From 907df9b8eda1951a70fbec3adb68029b367932a0 Mon Sep 17 00:00:00 2001 From: Gian Sass Date: Wed, 11 Apr 2018 14:55:49 -0400 Subject: [PATCH 1/3] Fix issue #124 --- .../web/mastodon_api/mastodon_api_controller.ex | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 21b99f919..21a3660c8 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -212,9 +212,14 @@ def user_statuses(%{assigns: %{user: user}} = conn, params) do |> Map.put("actor_id", ap_id) |> Map.put("whole_db", true) - activities = - ActivityPub.fetch_public_activities(params) - |> Enum.reverse() + if params["pinned"] == "true" do + # Since Pleroma has no "pinned" posts feature, we'll just set an empty list here + activities = [] + else + activities = + ActivityPub.fetch_public_activities(params) + |> Enum.reverse() + end conn |> add_link_headers(:user_statuses, activities, params["id"]) From 3a5c0465ebe87b74a96fcd19eca0d5284e0800a4 Mon Sep 17 00:00:00 2001 From: Gian Sass Date: Wed, 11 Apr 2018 15:48:32 -0400 Subject: [PATCH 2/3] Add unit test for pinned statuses --- .../web/mastodon_api/mastodon_api_controller_test.exs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 5d39c25c6..258d84122 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -316,6 +316,17 @@ test "gets a users statuses", %{conn: conn} do assert id == to_string(note_two.id) end + test "unimplemented pinned statuses feature", %{conn: conn} do + note = insert(:note_activity) + user = User.get_by_ap_id(note_two.data["actor"]) + + conn = + conn + |> get("/api/v1/accounts/#{user.id}/statuses?pinned=true") + + assert json_response(conn, 200) == [] + end + test "gets an users media", %{conn: conn} do note = insert(:note_activity) user = User.get_by_ap_id(note.data["actor"]) From 2de2e29df2a0359fe87337111866b46efb848b7d Mon Sep 17 00:00:00 2001 From: Gian Sass Date: Wed, 11 Apr 2018 15:51:02 -0400 Subject: [PATCH 3/3] Oops --- test/web/mastodon_api/mastodon_api_controller_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 258d84122..5293b9364 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -318,7 +318,7 @@ test "gets a users statuses", %{conn: conn} do test "unimplemented pinned statuses feature", %{conn: conn} do note = insert(:note_activity) - user = User.get_by_ap_id(note_two.data["actor"]) + user = User.get_by_ap_id(note.data["actor"]) conn = conn