From 1341ee650ecde656f385454264f43b21051e86f2 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Fri, 1 Mar 2019 09:37:29 +0300 Subject: [#675] Do not show DMs in mentions timeline --- test/web/twitter_api/twitter_api_controller_test.exs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'test/web/twitter_api/twitter_api_controller_test.exs') diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 05a832967..ed5683779 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -427,7 +427,10 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do test "with credentials", %{conn: conn, user: current_user} do {:ok, activity} = - ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: current_user}) + ActivityBuilder.insert( + %{"to" => [current_user.ap_id, "https://www.w3.org/ns/activitystreams#Public"]}, + %{user: current_user} + ) conn = conn @@ -445,6 +448,20 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do mentioned: [current_user] }) end + + test "does not show DMs in mentions timeline", %{conn: conn, user: current_user} do + {:ok, _activity} = + ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: current_user}) + + conn = + conn + |> with_credentials(current_user.nickname, "test") + |> get("/api/statuses/mentions.json") + + response = json_response(conn, 200) + + assert length(response) == 0 + end end describe "GET /api/qvitter/statuses/notifications.json" do -- cgit v1.2.3 From 9c6abec4d8b2487edeb124aa197a5dd6d771e345 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Fri, 1 Mar 2019 15:48:04 +0300 Subject: use commonapi.post instead of activitybulder --- test/web/twitter_api/twitter_api_controller_test.exs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'test/web/twitter_api/twitter_api_controller_test.exs') diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index ed5683779..7125d85ab 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -427,10 +427,10 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do test "with credentials", %{conn: conn, user: current_user} do {:ok, activity} = - ActivityBuilder.insert( - %{"to" => [current_user.ap_id, "https://www.w3.org/ns/activitystreams#Public"]}, - %{user: current_user} - ) + CommonAPI.post(current_user, %{ + "status" => "why is tenshi eating a corndog so cute?", + "visibility" => "public" + }) conn = conn @@ -451,7 +451,10 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do test "does not show DMs in mentions timeline", %{conn: conn, user: current_user} do {:ok, _activity} = - ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: current_user}) + CommonAPI.post(current_user, %{ + "status" => "Have you guys ever seen how cute tenshi eating a corndog is?", + "visibility" => "direct" + }) conn = conn -- cgit v1.2.3 From d5418e9ff78785c48bc94fbc8cb146ffe90c1fc5 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Sun, 3 Mar 2019 18:39:37 +0300 Subject: Remove follow_request_count as it's not needed for FE anymore. MastoFE uses `GET /api/v1/follow_requests` and PleromaFE uses `GET /api/pleroma/friend_requests` which they query on the initial page load. --- test/web/twitter_api/twitter_api_controller_test.exs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'test/web/twitter_api/twitter_api_controller_test.exs') diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 7125d85ab..d18b65876 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -690,7 +690,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do followed = Repo.get(User, followed.id) refute User.ap_followers(followed) in current_user.following - assert followed.info.follow_request_count == 1 assert json_response(conn, 200) == UserView.render("show.json", %{user: followed, for: current_user}) @@ -1757,7 +1756,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do other_user = Repo.get(User, other_user.id) assert User.following?(other_user, user) == false - assert user.info.follow_request_count == 1 conn = build_conn() @@ -1769,7 +1767,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do assert relationship = json_response(conn, 200) assert other_user.id == relationship["id"] assert relationship["follows_you"] == true - assert user.info.follow_request_count == 0 end end @@ -1784,7 +1781,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do other_user = Repo.get(User, other_user.id) assert User.following?(other_user, user) == false - assert user.info.follow_request_count == 1 conn = build_conn() @@ -1796,7 +1792,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do assert relationship = json_response(conn, 200) assert other_user.id == relationship["id"] assert relationship["follows_you"] == false - assert user.info.follow_request_count == 0 end end -- cgit v1.2.3