Do not stream out Announces to public timelines
This commit is contained in:
parent
f9b86c3c22
commit
ffd379456b
2 changed files with 30 additions and 3 deletions
|
@ -29,7 +29,7 @@ defmodule Pleroma.Activity.Ir.Topics do
|
||||||
["user", "list"] ++ visibility_tags(object, activity)
|
["user", "list"] ++ visibility_tags(object, activity)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp visibility_tags(object, activity) do
|
defp visibility_tags(object, %{data: %{"type" => "Create"}} = activity) do
|
||||||
case Visibility.get_visibility(activity) do
|
case Visibility.get_visibility(activity) do
|
||||||
"public" ->
|
"public" ->
|
||||||
if activity.local do
|
if activity.local do
|
||||||
|
@ -51,6 +51,10 @@ defmodule Pleroma.Activity.Ir.Topics do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp visibility_tags(_object, _activity) do
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
defp item_creation_tags(tags, object, %{data: %{"type" => "Create"}} = activity) do
|
defp item_creation_tags(tags, object, %{data: %{"type" => "Create"}} = activity) do
|
||||||
tags ++
|
tags ++
|
||||||
remote_topics(activity) ++ hashtags_to_topics(object) ++ attachment_topics(object, activity)
|
remote_topics(activity) ++ hashtags_to_topics(object) ++ attachment_topics(object, activity)
|
||||||
|
|
|
@ -58,7 +58,7 @@ defmodule Pleroma.Activity.Ir.TopicsTest do
|
||||||
setup do
|
setup do
|
||||||
activity = %Activity{
|
activity = %Activity{
|
||||||
object: %Object{data: %{"type" => "Note"}},
|
object: %Object{data: %{"type" => "Note"}},
|
||||||
data: %{"to" => [Pleroma.Constants.as_public()]}
|
data: %{"to" => [Pleroma.Constants.as_public()], "type" => "Create"}
|
||||||
}
|
}
|
||||||
|
|
||||||
{:ok, activity: activity}
|
{:ok, activity: activity}
|
||||||
|
@ -137,6 +137,25 @@ defmodule Pleroma.Activity.Ir.TopicsTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "public visibility Announces" do
|
||||||
|
setup do
|
||||||
|
activity = %Activity{
|
||||||
|
object: %Object{data: %{"attachment" => []}},
|
||||||
|
data: %{"type" => "Announce", "to" => [Pleroma.Constants.as_public()]}
|
||||||
|
}
|
||||||
|
|
||||||
|
{:ok, activity: activity}
|
||||||
|
end
|
||||||
|
|
||||||
|
test "does not generate public topics", %{activity: activity} do
|
||||||
|
topics = Topics.get_activity_topics(activity)
|
||||||
|
|
||||||
|
refute "public" in topics
|
||||||
|
refute "public:remote" in topics
|
||||||
|
refute "public:local" in topics
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "local-public visibility create events" do
|
describe "local-public visibility create events" do
|
||||||
setup do
|
setup do
|
||||||
activity = %Activity{
|
activity = %Activity{
|
||||||
|
@ -230,7 +249,11 @@ defmodule Pleroma.Activity.Ir.TopicsTest do
|
||||||
|
|
||||||
describe "non-public visibility" do
|
describe "non-public visibility" do
|
||||||
test "produces direct topic" do
|
test "produces direct topic" do
|
||||||
activity = %Activity{object: %Object{data: %{"type" => "Note"}}, data: %{"to" => []}}
|
activity = %Activity{
|
||||||
|
object: %Object{data: %{"type" => "Note"}},
|
||||||
|
data: %{"to" => [], "type" => "Create"}
|
||||||
|
}
|
||||||
|
|
||||||
topics = Topics.get_activity_topics(activity)
|
topics = Topics.get_activity_topics(activity)
|
||||||
|
|
||||||
assert Enum.member?(topics, "direct")
|
assert Enum.member?(topics, "direct")
|
||||||
|
|
Loading…
Reference in a new issue