- `preview`: boolean, if set to `true` the post won't be actually posted, but the status entitiy would still be rendered back. This could be useful for previewing rich text/custom emoji, for example.
- `content_type`: string, contain the MIME type of the status, it is transformed into HTML by the backend. You can get the list of the supported MIME types with the nodeinfo endpoint.
+ - `to`: A list of nicknames (like `lain@soykaf.club` or `lain` on the local server) that will be used to determine who is going to be addressed by this post. Using this will disable the implicit addressing by mentioned names in the `status` body, only the people in the `to` list will be addressed. The normal rules for for post visibility are not affected by this and will still apply.
+- `visibility`: string, besides standard MastoAPI values (`direct`, `private`, `unlisted` or `public`) it can be used to address a List by setting it to `list:LIST_ID`.
## PATCH `/api/v1/update_credentials`
data,
visibility
),
+ mentioned_users <- for({_, mentioned_user} <- mentions, do: mentioned_user.ap_id),
+ addressed_users <- get_addressed_users(mentioned_users, data["to"]),
{poll, poll_emoji} <- make_poll_data(data),
- {to, cc} <- to_for_user_and_mentions(user, mentions, in_reply_to, visibility),
+ {to, cc} <- get_to_and_cc(user, addressed_users, in_reply_to, visibility),
+ bcc <- bcc_for_list(user, visibility),
context <- make_context(in_reply_to),
cw <- data["spoiler_text"] || "",
sensitive <- data["sensitive"] || Enum.member?(tags, {"#nsfw", "nsfw"}),
end
end
- def to_for_user_and_mentions(_user, _mentions, _inReplyTo, _), do: {[], []}
+ def get_addressed_users(_, to) when is_list(to) do
+ User.get_ap_ids_by_nicknames(to)
+ end
+
+ def get_addressed_users(mentioned_users, _), do: mentioned_users
+ def bcc_for_list(user, {:list, list_id}) do
+ list = Pleroma.List.get(list_id, user)
+ [list.ap_id]
+ end
+
+ def bcc_for_list(_, _), do: []
+
def make_poll_data(%{"poll" => %{"options" => options, "expires_in" => expires_in}} = data)
when is_list(options) do
%{max_expiration: max_expiration, min_expiration: min_expiration} =