Ensure self-announces do not widen the audience of the original post
This commit is contained in:
parent
1f0be71ea4
commit
fe538973dd
2 changed files with 4 additions and 3 deletions
|
@ -346,7 +346,7 @@ def announce(
|
|||
local \\ true,
|
||||
public \\ true
|
||||
) do
|
||||
with true <- is_announceable?(object, user),
|
||||
with true <- is_announceable?(object, user, public),
|
||||
announce_data <- make_announce_data(user, object, activity_id, public),
|
||||
{:ok, activity} <- insert(announce_data, local),
|
||||
{:ok, object} <- add_announce_to_object(activity, object),
|
||||
|
|
|
@ -27,8 +27,9 @@ def is_private?(activity) do
|
|||
end
|
||||
end
|
||||
|
||||
def is_announceable?(activity, user) do
|
||||
is_public?(activity) || activity.data["actor"] == user.ap_id
|
||||
def is_announceable?(activity, user, public \\ true) do
|
||||
is_public?(activity) ||
|
||||
(!public && is_private?(activity) && activity.data["actor"] == user.ap_id)
|
||||
end
|
||||
|
||||
def is_direct?(%Activity{data: %{"directMessage" => true}}), do: true
|
||||
|
|
Loading…
Reference in a new issue