diff options
author | kaniini <ariadne@dereferenced.org> | 2019-07-15 13:00:33 +0000 |
---|---|---|
committer | kaniini <ariadne@dereferenced.org> | 2019-07-15 13:00:33 +0000 |
commit | d725ccfd3adce35c91c9d55414f47022bf0d67ed (patch) | |
tree | 38361610903bd6034f6a66dcd9e747e187d328d9 /lib/pleroma/web/common_api/utils.ex | |
parent | 46ef8f021635c630bcd6973e6fbb7c58bcafb6bf (diff) | |
parent | de13c9bb8fc08b12d9694f63f92935ba39a51118 (diff) | |
download | pleroma-d725ccfd3adce35c91c9d55414f47022bf0d67ed.tar.gz |
Merge branch 'feature/addressable-lists' into 'develop'
[#802] Add addressable lists
See merge request pleroma/pleroma!1113
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 8e482eef7..f28a96320 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -100,12 +100,29 @@ defmodule Pleroma.Web.CommonAPI.Utils do end end + def get_to_and_cc(_user, mentions, _inReplyTo, {:list, _}), do: {mentions, []} + 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 maybe_add_list_data(activity_params, user, {:list, list_id}) do + case Pleroma.List.get(list_id, user) do + %Pleroma.List{} = list -> + activity_params + |> put_in([:additional, "bcc"], [list.ap_id]) + |> put_in([:additional, "listMessage"], list.ap_id) + |> put_in([:object, "listMessage"], list.ap_id) + + _ -> + activity_params + end + end + + def maybe_add_list_data(activity_params, _, _), do: activity_params + 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} = |