aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoreugenijm <eugenijm@protonmail.com>2019-10-09 06:51:14 +0300
committereugenijm <eugenijm@protonmail.com>2019-10-09 07:27:09 +0300
commit580a67f5ca152fa4454fd9d8ab2e2a5a55af1a2a (patch)
tree4e6e9e235afe2a394949dd8e5278ebc7f26311f9 /test
parent6355694309b0bad3687a8a7820b81ebf6625751d (diff)
downloadpleroma-580a67f5ca152fa4454fd9d8ab2e2a5a55af1a2a.tar.gz
Mastodon API: Return `pleroma.direct_conversation_id` when viewing a status (`GET /api/v1/statuses/:id`)
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/controllers/status_controller_test.exs19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs
index a4bbfe055..2de2725e0 100644
--- a/test/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/web/mastodon_api/controllers/status_controller_test.exs
@@ -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)