aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-08-02 15:05:27 +0200
committerlain <lain@soykaf.club>2019-08-02 15:05:27 +0200
commit56b1c3af13c9519e13da688bdbbfdd8d69cda4ac (patch)
tree96c512e8cbc63528b4e607e58fe6a75b0d6495eb /test
parentf88560accd801ac88c60344cef93ef00cf136069 (diff)
downloadpleroma-56b1c3af13c9519e13da688bdbbfdd8d69cda4ac.tar.gz
CommonAPI: Extend api with conversation replies.
Diffstat (limited to 'test')
-rw-r--r--test/web/common_api/common_api_test.exs30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 16b3f121d..e2a5bf117 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -5,6 +5,7 @@
defmodule Pleroma.Web.CommonAPITest do
use Pleroma.DataCase
alias Pleroma.Activity
+ alias Pleroma.Conversation.Participation
alias Pleroma.Object
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
@@ -12,6 +13,35 @@ defmodule Pleroma.Web.CommonAPITest do
import Pleroma.Factory
+ test "when replying to a conversation / participation, it only mentions the recipients explicitly declared in the participation" do
+ har = insert(:user)
+ jafnhar = insert(:user)
+ tridi = insert(:user)
+
+ {:ok, activity} =
+ CommonAPI.post(har, %{
+ "status" => "@#{jafnhar.nickname} hey",
+ "visibility" => "direct"
+ })
+
+ assert har.ap_id in activity.recipients
+ assert jafnhar.ap_id in activity.recipients
+
+ [participation] = Participation.for_user(har)
+
+ {:ok, activity} =
+ CommonAPI.post(har, %{
+ "status" => "I don't really like @#{tridi.nickname}",
+ "visibility" => "direct",
+ "in_reply_to_status_id" => activity.id,
+ "in_reply_to_conversation_id" => participation.id
+ })
+
+ assert har.ap_id in activity.recipients
+ assert jafnhar.ap_id in activity.recipients
+ refute tridi.ap_id in activity.recipients
+ end
+
test "with the safe_dm_mention option set, it does not mention people beyond the initial tags" do
har = insert(:user)
jafnhar = insert(:user)