forked from AkkomaGang/akkoma
Fix specs.
This commit is contained in:
parent
4ea2a41014
commit
8a47974217
4 changed files with 7 additions and 6 deletions
|
@ -47,7 +47,7 @@ def unfavorite(id_or_ap_id, user) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_visibility(%{"visibility" => visibility}), do: visibility
|
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)
|
inReplyTo = get_replied_to_activity(status_id)
|
||||||
Pleroma.Web.MastodonAPI.StatusView.get_visibility(inReplyTo.data["object"])
|
Pleroma.Web.MastodonAPI.StatusView.get_visibility(inReplyTo.data["object"])
|
||||||
end
|
end
|
||||||
|
|
|
@ -182,7 +182,7 @@ def user_statuses(%{assigns: %{user: user}} = conn, params) do
|
||||||
|> Map.put("actor_id", ap_id)
|
|> Map.put("actor_id", ap_id)
|
||||||
|> Map.put("whole_db", true)
|
|> Map.put("whole_db", true)
|
||||||
|
|
||||||
activities = ActivityPub.fetch_activities([], params)
|
activities = ActivityPub.fetch_public_activities(params)
|
||||||
|> Enum.reverse
|
|> Enum.reverse
|
||||||
|
|
||||||
render conn, StatusView, "index.json", %{activities: activities, for: user, as: :activity}
|
render conn, StatusView, "index.json", %{activities: activities, for: user, as: :activity}
|
||||||
|
@ -465,12 +465,12 @@ def account_search(%{assigns: %{user: user}} = conn, %{"q" => query} = params) d
|
||||||
end
|
end
|
||||||
|
|
||||||
def favourites(%{assigns: %{user: user}} = conn, _) do
|
def favourites(%{assigns: %{user: user}} = conn, _) do
|
||||||
params = conn
|
params = %{}
|
||||||
|> Map.put("type", "Create")
|
|> Map.put("type", "Create")
|
||||||
|> Map.put("favorited_by", user.ap_id)
|
|> Map.put("favorited_by", user.ap_id)
|
||||||
|> Map.put("blocking_user", user)
|
|> Map.put("blocking_user", user)
|
||||||
|
|
||||||
activities = ActivityPub.fetch_activities([], params)
|
activities = ActivityPub.fetch_public_activities(params)
|
||||||
|> Enum.reverse
|
|> Enum.reverse
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -14,6 +14,8 @@ def build(data \\ %{}) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert(data \\ %{}) do
|
def insert(data \\ %{}) do
|
||||||
Repo.insert(build(data))
|
{:ok, user} = Repo.insert(build(data))
|
||||||
|
User.invalidate_cache(user)
|
||||||
|
{:ok, user}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -218,7 +218,6 @@ test "without any params", %{conn: conn} do
|
||||||
test "with user_id", %{conn: conn} do
|
test "with user_id", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
{:ok, activity} = ActivityBuilder.insert(%{"id" => 1}, %{user: user})
|
{:ok, activity} = ActivityBuilder.insert(%{"id" => 1}, %{user: user})
|
||||||
|> IO.inspect
|
|
||||||
|
|
||||||
conn = get(conn, "/api/statuses/user_timeline.json", %{"user_id" => user.id})
|
conn = get(conn, "/api/statuses/user_timeline.json", %{"user_id" => user.id})
|
||||||
response = json_response(conn, 200)
|
response = json_response(conn, 200)
|
||||||
|
|
Loading…
Reference in a new issue