Merge branch 'develop' into feature/reports-groups-and-multiple-state-update
This commit is contained in:
commit
24eecc3cb4
136 changed files with 864 additions and 320 deletions
|
|
@ -40,7 +40,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|
|||
test "search", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
user_two = insert(:user, %{nickname: "shp@shitposter.club"})
|
||||
user_three = insert(:user, %{nickname: "shp@heldscal.la", name: "I love 2hu"})
|
||||
user_three = insert(:user, %{nickname: "shp@heldscal.la", name: "I love 2hu 天子"})
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "This is about 2hu private"})
|
||||
|
||||
|
|
@ -52,9 +52,9 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|
|||
|
||||
{:ok, _} = CommonAPI.post(user_two, %{"status" => "This isn't"})
|
||||
|
||||
conn = get(conn, "/api/v2/search", %{"q" => "2hu #private"})
|
||||
|
||||
assert results = json_response(conn, 200)
|
||||
results =
|
||||
get(conn, "/api/v2/search", %{"q" => "2hu #private"})
|
||||
|> json_response(200)
|
||||
|
||||
[account | _] = results["accounts"]
|
||||
assert account["id"] == to_string(user_three.id)
|
||||
|
|
@ -65,6 +65,13 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|
|||
|
||||
[status] = results["statuses"]
|
||||
assert status["id"] == to_string(activity.id)
|
||||
|
||||
results =
|
||||
get(conn, "/api/v2/search", %{"q" => "天子"})
|
||||
|> json_response(200)
|
||||
|
||||
[account] == results["accounts"]
|
||||
assert account["id"] == to_string(user_three.id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
alias Pleroma.Activity
|
||||
alias Pleroma.ActivityExpiration
|
||||
alias Pleroma.Config
|
||||
alias Pleroma.Conversation.Participation
|
||||
alias Pleroma.Object
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.ScheduledActivity
|
||||
|
|
@ -465,6 +466,24 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
assert id == to_string(activity.id)
|
||||
end
|
||||
|
||||
test "get a direct status", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, activity} =
|
||||
CommonAPI.post(user, %{"status" => "@#{other_user.nickname}", "visibility" => "direct"})
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> get("/api/v1/statuses/#{activity.id}")
|
||||
|
||||
[participation] = Participation.for_user(user)
|
||||
|
||||
res = json_response(conn, 200)
|
||||
assert res["pleroma"]["direct_conversation_id"] == participation.id
|
||||
end
|
||||
|
||||
test "get statuses by IDs", %{conn: conn} do
|
||||
%{id: id1} = insert(:note_activity)
|
||||
%{id: id2} = insert(:note_activity)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue