Remove non-local recipients from local post addressing
They won’t receive local-only posts anyway so it makes no sense to list them as recipients.
This commit is contained in:
parent
2cdc4acce9
commit
f452430acc
1 changed files with 18 additions and 7 deletions
|
|
@ -73,13 +73,8 @@ def get_to_and_cc(%{visibility: visibility} = draft) do
|
|||
)
|
||||
end
|
||||
|
||||
def get_to_and_cc_for_visibility(visibility, follower_collection, parent_actor, mentions)
|
||||
when visibility in ["public", "local"] do
|
||||
scope_addr =
|
||||
case visibility do
|
||||
"public" -> Pleroma.Constants.as_public()
|
||||
"local" -> Utils.as_local_public()
|
||||
end
|
||||
def get_to_and_cc_for_visibility("public", follower_collection, parent_actor, mentions) do
|
||||
scope_addr = Pleroma.Constants.as_public()
|
||||
|
||||
to =
|
||||
if parent_actor,
|
||||
|
|
@ -89,6 +84,22 @@ def get_to_and_cc_for_visibility(visibility, follower_collection, parent_actor,
|
|||
{to, [follower_collection]}
|
||||
end
|
||||
|
||||
def get_to_and_cc_for_visibility("local", follower_collection, parent_actor, mentions) do
|
||||
recipients =
|
||||
if parent_actor,
|
||||
do: Enum.uniq([parent_actor | mentions]),
|
||||
else: mentions
|
||||
|
||||
to = [
|
||||
Utils.as_local_public()
|
||||
| Enum.filter(recipients, fn addr ->
|
||||
String.starts_with?(addr, Pleroma.Web.Endpoint.url() <> "/")
|
||||
end)
|
||||
]
|
||||
|
||||
{to, [follower_collection]}
|
||||
end
|
||||
|
||||
def get_to_and_cc_for_visibility("unlisted", follower_collection, parent_actor, mentions) do
|
||||
to =
|
||||
if parent_actor,
|
||||
|
|
|
|||
Loading…
Reference in a new issue