mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 16:16:34 +00:00
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
This commit is contained in:
commit
d031b185e2
3 changed files with 16 additions and 0 deletions
|
@ -47,6 +47,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
|
||||
|
||||
## Unreleased (Patch)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue