forked from AkkomaGang/akkoma
common api: utils: flip to/cc for mentions
This commit is contained in:
parent
3e33479c05
commit
4e93d6ae14
1 changed files with 14 additions and 6 deletions
|
@ -34,21 +34,29 @@ def attachments_from_ids(ids) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_for_user_and_mentions(user, mentions, inReplyTo, "public") do
|
def to_for_user_and_mentions(user, mentions, inReplyTo, "public") do
|
||||||
to = ["https://www.w3.org/ns/activitystreams#Public"]
|
|
||||||
|
|
||||||
mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end)
|
mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end)
|
||||||
cc = [user.follower_address | mentioned_users]
|
|
||||||
|
to = ["https://www.w3.org/ns/activitystreams#Public" | mentioned_users]
|
||||||
|
cc = [user.follower_address]
|
||||||
|
|
||||||
if inReplyTo do
|
if inReplyTo do
|
||||||
{to, Enum.uniq([inReplyTo.data["actor"] | cc])}
|
{Enum.uniq([inReplyTo.data["actor"] | to]), cc}
|
||||||
else
|
else
|
||||||
{to, cc}
|
{to, cc}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_for_user_and_mentions(user, mentions, inReplyTo, "unlisted") do
|
def to_for_user_and_mentions(user, mentions, inReplyTo, "unlisted") do
|
||||||
{to, cc} = to_for_user_and_mentions(user, mentions, inReplyTo, "public")
|
mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end)
|
||||||
{cc, to}
|
|
||||||
|
to = [user.follower_address | mentioned_users]
|
||||||
|
cc = ["https://www.w3.org/ns/activitystreams#Public"]
|
||||||
|
|
||||||
|
if inReplyTo do
|
||||||
|
{Enum.uniq([inReplyTo.data["actor"] | to]), cc}
|
||||||
|
else
|
||||||
|
{to, cc}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_for_user_and_mentions(user, mentions, inReplyTo, "private") do
|
def to_for_user_and_mentions(user, mentions, inReplyTo, "private") do
|
||||||
|
|
Loading…
Reference in a new issue