diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-11-08 19:17:01 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-11-08 19:17:01 +0000 |
commit | 4e93d6ae14fc2e4829769e58e66b6fb95e661e7f (patch) | |
tree | 3c80d00da595834cfc49286aa72ff37c1a2a4db5 /lib | |
parent | 3e33479c05c315e04b0947136f1429c79c85c63c (diff) | |
download | pleroma-4e93d6ae14fc2e4829769e58e66b6fb95e661e7f.tar.gz pleroma-4e93d6ae14fc2e4829769e58e66b6fb95e661e7f.zip |
common api: utils: flip to/cc for mentions
Diffstat (limited to 'lib')
-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 |