diff options
author | rinpatch <rinpatch@sdf.org> | 2020-10-22 10:56:17 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-11-04 17:12:37 +0300 |
commit | 7058cac1c2eeb46ef6e95b6af863c931f8d38f06 (patch) | |
tree | 8c1b5375d987fef295b76063b014015a9b66692c | |
parent | 6c8469664a08d2cd02bd8e6d998d8e2d5f07dac5 (diff) | |
download | pleroma-7058cac1c2eeb46ef6e95b6af863c931f8d38f06.tar.gz |
Merge branch '2257-self-chat' into 'develop'
Resolve "Can't message yourself in a chat (but can start it)"
Closes #2257
See merge request pleroma/pleroma!3099
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/side_effects.ex | 1 | ||||
-rw-r--r-- | test/pleroma/web/common_api_test.exs | 14 |
3 files changed, 16 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 80ca6a350..01038b7ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ switched to a new configuration mechanism, however it was not officially removed - Add documented-but-missing chat pagination. - Allow sending out emails again. +- Allow sending chat messages to yourself ### Upgrade notes diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index d421ca7af..0fff5faf2 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -306,6 +306,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do streamables = [[actor, recipient], [recipient, actor]] + |> Enum.uniq() |> Enum.map(fn [user, other_user] -> if user.local do {:ok, chat} = Chat.bump_or_create(user.id, other_user.ap_id) diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 64476a099..c5b90ad84 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -95,6 +95,20 @@ defmodule Pleroma.Web.CommonAPITest do describe "posting chat messages" do setup do: clear_config([:instance, :chat_limit]) + test "it posts a self-chat" do + author = insert(:user) + recipient = author + + {:ok, activity} = + CommonAPI.post_chat_message( + author, + recipient, + "remember to buy milk when milk truk arive" + ) + + assert activity.data["type"] == "Create" + end + test "it posts a chat message without content but with an attachment" do author = insert(:user) recipient = insert(:user) |