mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Do not stream out Create of ChatMessage
This commit is contained in:
parent
9b68778887
commit
e46c3a0595
2 changed files with 31 additions and 0 deletions
|
@ -13,6 +13,14 @@ defmodule Pleroma.Activity.Ir.Topics do
|
||||||
|> List.flatten()
|
|> List.flatten()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp generate_topics(%{data: %{"type" => "ChatMessage"}}, %{data: %{"type" => "Delete"}}) do
|
||||||
|
["user", "user:pleroma_chat"]
|
||||||
|
end
|
||||||
|
|
||||||
|
defp generate_topics(%{data: %{"type" => "ChatMessage"}}, %{data: %{"type" => "Create"}}) do
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
defp generate_topics(%{data: %{"type" => "Answer"}}, _) do
|
defp generate_topics(%{data: %{"type" => "Answer"}}, _) do
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,29 @@ defmodule Pleroma.Activity.Ir.TopicsTest do
|
||||||
|
|
||||||
import Mock
|
import Mock
|
||||||
|
|
||||||
|
describe "chat message" do
|
||||||
|
test "Create produces no topics" do
|
||||||
|
activity = %Activity{
|
||||||
|
object: %Object{data: %{"type" => "ChatMessage"}},
|
||||||
|
data: %{"type" => "Create"}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert [] == Topics.get_activity_topics(activity)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "Delete produces user and user:pleroma_chat" do
|
||||||
|
activity = %Activity{
|
||||||
|
object: %Object{data: %{"type" => "ChatMessage"}},
|
||||||
|
data: %{"type" => "Delete"}
|
||||||
|
}
|
||||||
|
|
||||||
|
topics = Topics.get_activity_topics(activity)
|
||||||
|
assert [_, _] = topics
|
||||||
|
assert "user" in topics
|
||||||
|
assert "user:pleroma_chat" in topics
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "poll answer" do
|
describe "poll answer" do
|
||||||
test "produce no topics" do
|
test "produce no topics" do
|
||||||
activity = %Activity{object: %Object{data: %{"type" => "Answer"}}}
|
activity = %Activity{object: %Object{data: %{"type" => "Answer"}}}
|
||||||
|
|
Loading…
Reference in a new issue