- def make_content_html(status, mentions, attachments, tags, no_attachment_links \\ false) do
+ def to_for_user_and_mentions(user, mentions, inReplyTo, "unlisted") do
+ {to, cc} = to_for_user_and_mentions(user, mentions, inReplyTo, "public")
+ {cc, to}
+ end
+
+ def to_for_user_and_mentions(user, mentions, inReplyTo, "private") do
+ {to, cc} = to_for_user_and_mentions(user, mentions, inReplyTo, "direct")
+ {[user.follower_address | to], cc}
+ end
+
+ def to_for_user_and_mentions(_user, mentions, inReplyTo, "direct") do
+ mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end)
+
+ if inReplyTo do
+ {Enum.uniq([inReplyTo.data["actor"] | mentioned_users]), []}
+ else
+ {mentioned_users, []}
+ end
+ end
+
+ def make_content_html(
+ status,
+ mentions,
+ attachments,
+ tags,
+ content_type,
+ no_attachment_links \\ false
+ ) do