diff options
author | lain <lain@soykaf.club> | 2019-10-05 14:53:50 +0200 |
---|---|---|
committer | Ariadne Conill <ariadne@dereferenced.org> | 2019-10-05 19:31:11 +0000 |
commit | b97a7709c7f53541aca54ebab63d3307dc33ab1e (patch) | |
tree | 700dbaacf21795122f31c7705437447515bda8fe | |
parent | 4d85e07e9e64e4e3fd63d94094d6c0b934452f74 (diff) | |
download | pleroma-b97a7709c7f53541aca54ebab63d3307dc33ab1e.tar.gz |
CommonAPI: Create profile updates as public.
This saves us lots of sending out because we can use sharedInbox.
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 4 | ||||
-rw-r--r-- | test/web/common_api/common_api_test.exs | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 5faddc9f4..184ec6021 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -17,6 +17,8 @@ defmodule Pleroma.Web.CommonAPI do import Pleroma.Web.Gettext import Pleroma.Web.CommonAPI.Utils + require Pleroma.Constants + def follow(follower, followed) do with {:ok, follower} <- User.maybe_direct_follow(follower, followed), {:ok, activity} <- ActivityPub.follow(follower, followed), @@ -316,7 +318,7 @@ defmodule Pleroma.Web.CommonAPI do ActivityPub.update(%{ local: true, - to: [user.follower_address], + to: [Pleroma.Constants.as_public(), user.follower_address], cc: [], actor: user.ap_id, object: Pleroma.Web.ActivityPub.UserView.render("user.json", %{user: user}) diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index f28a66090..693dd40bd 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -14,6 +14,8 @@ defmodule Pleroma.Web.CommonAPITest do import Pleroma.Factory + require Pleroma.Constants + clear_config([:instance, :safe_dm_mentions]) clear_config([:instance, :limit]) clear_config([:instance, :max_pinned_statuses]) @@ -96,11 +98,13 @@ defmodule Pleroma.Web.CommonAPITest do test "it adds emoji when updating profiles" do user = insert(:user, %{name: ":firefox:"}) - CommonAPI.update(user) + {:ok, activity} = CommonAPI.update(user) user = User.get_cached_by_ap_id(user.ap_id) [firefox] = user.info.source_data["tag"] assert firefox["name"] == ":firefox:" + + assert Pleroma.Constants.as_public() in activity.recipients end describe "posting" do |