Fix specs.
authorlain <lain@soykaf.club>
Sun, 25 Feb 2018 17:08:41 +0000 (18:08 +0100)
committerlain <lain@soykaf.club>
Sun, 25 Feb 2018 17:11:03 +0000 (18:11 +0100)
lib/pleroma/web/common_api/common_api.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
test/support/builders/user_builder.ex
test/web/twitter_api/twitter_api_controller_test.exs

index 5bd6e136f22c99506ea7c999e6feb742c1ddf2a7..d85a7cf5e4fc16d8d30e093b37874c4c7e74db9c 100644 (file)
@@ -47,7 +47,7 @@ defmodule Pleroma.Web.CommonAPI do
   end
 
   def get_visibility(%{"visibility" => visibility}), do: visibility
-  def get_visibility(%{"in_reply_to_status_id" => status_id}) do
+  def get_visibility(%{"in_reply_to_status_id" => status_id}) when status_id do
     inReplyTo = get_replied_to_activity(status_id)
     Pleroma.Web.MastodonAPI.StatusView.get_visibility(inReplyTo.data["object"])
   end
index 45b4d24c62b1fe6af59ada5211783816e99df7c1..1f010a8eef9f2047eaf0df970eef61549ac099f4 100644 (file)
@@ -182,7 +182,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
       |> Map.put("actor_id", ap_id)
       |> Map.put("whole_db", true)
 
-      activities = ActivityPub.fetch_activities([], params)
+      activities = ActivityPub.fetch_public_activities(params)
       |> Enum.reverse
 
       render conn, StatusView, "index.json", %{activities: activities, for: user, as: :activity}
@@ -465,12 +465,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   end
 
   def favourites(%{assigns: %{user: user}} = conn, _) do
-    params = conn
+    params = %{}
     |> Map.put("type", "Create")
     |> Map.put("favorited_by", user.ap_id)
     |> Map.put("blocking_user", user)
 
-    activities = ActivityPub.fetch_activities([], params)
+    activities = ActivityPub.fetch_public_activities(params)
     |> Enum.reverse
 
     conn
index 710a1b87cbdd5735681b44894e4184718bfa9882..1e1e80ac9a96a4031275c7716fed1eeef282ab44 100644 (file)
@@ -14,6 +14,8 @@ defmodule Pleroma.Builders.UserBuilder do
   end
 
   def insert(data \\ %{}) do
-    Repo.insert(build(data))
+    {:ok, user} = Repo.insert(build(data))
+    User.invalidate_cache(user)
+    {:ok, user}
   end
 end
index fbeec66058da2ac0b7114bd8b8aa9003af011601..d3040f0dce3de6b8828f63184397dc7cf2e9e551 100644 (file)
@@ -218,7 +218,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
     test "with user_id", %{conn: conn} do
       user = insert(:user)
       {:ok, activity} = ActivityBuilder.insert(%{"id" => 1}, %{user: user})
-      |> IO.inspect
 
       conn = get(conn, "/api/statuses/user_timeline.json", %{"user_id" => user.id})
       response = json_response(conn, 200)