Ver código fonte

SideEffects: Correctly handle chat messages sent to yourself

2298-weird-follow-issue
lain 3 anos atrás
pai
commit
8d251096fe
2 arquivos alterados com 15 adições e 0 exclusões
  1. +1
    -0
      lib/pleroma/web/activity_pub/side_effects.ex
  2. +14
    -0
      test/pleroma/web/common_api_test.exs

+ 1
- 0
lib/pleroma/web/activity_pub/side_effects.ex Ver arquivo

@@ -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)


+ 14
- 0
test/pleroma/web/common_api_test.exs Ver arquivo

@@ -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)


Carregando…
Cancelar
Salvar