diff options
author | lambda <pleromagit@rogerbraun.net> | 2018-11-09 16:00:24 +0000 |
---|---|---|
committer | lambda <pleromagit@rogerbraun.net> | 2018-11-09 16:00:24 +0000 |
commit | b4bd5e40e491c8b777c75ec4f096c0c466a6b4e2 (patch) | |
tree | 6ac868c99eccc9299e8601e104c458c7775bee26 /lib/pleroma/web/common_api/utils.ex | |
parent | a44d87f0594ad10809afe269e20e8d4c777b5d5c (diff) | |
parent | e4971553c74436b7060f410fe6cbd4f7a9c13b80 (diff) | |
download | pleroma-b4bd5e40e491c8b777c75ec4f096c0c466a6b4e2.tar.gz |
Merge branch 'bugfix/no-cc-mentions' into 'develop'
align to/cc addressing pattern with friendica, hubzilla instead of mastodon
Closes #341
See merge request pleroma/pleroma!436
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index b22c4cc03..728f24c7e 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -34,21 +34,29 @@ defmodule Pleroma.Web.CommonAPI.Utils do end 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) - cc = [user.follower_address | mentioned_users] + + to = ["https://www.w3.org/ns/activitystreams#Public" | mentioned_users] + cc = [user.follower_address] if inReplyTo do - {to, Enum.uniq([inReplyTo.data["actor"] | cc])} + {Enum.uniq([inReplyTo.data["actor"] | to]), cc} else {to, cc} end end def to_for_user_and_mentions(user, mentions, inReplyTo, "unlisted") do - {to, cc} = to_for_user_and_mentions(user, mentions, inReplyTo, "public") - {cc, to} + mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end) + + 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 def to_for_user_and_mentions(user, mentions, inReplyTo, "private") do |