create_service_actor is now type Application
authorilja <git@ilja.space>
Sat, 4 Feb 2023 20:53:23 +0000 (20:53 +0000)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Sat, 4 Feb 2023 21:00:21 +0000 (21:00 +0000)
This is used for internal fetch and for relay. Both represent the instance and therefore are an aplication.

CHANGELOG.md
lib/pleroma/user.ex
priv/repo/migrations/20230202154409_instance_actors_to_actor_type_application.exs [new file with mode: 0644]
test/pleroma/web/activity_pub/relay_test.exs

index e6effac7820395955e6728250eb40df718fa9662..d66959efb3b8212b659c5700a32e5679deab17c4 100644 (file)
@@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Rich media will now hard-exit after 5 seconds, to prevent timeline hangs
 - HTTP Content Security Policy is now far more strict to prevent any potential XSS/CSS leakages
 - Follow requests are now paginated, matches mastodon API spec, so use the Link header to paginate.
+- `internal.fetch` and `relay` actors are now represented with the actor type `Application`
 
 ### Fixed 
 - /api/v1/accounts/lookup will now respect restrict\_unauthenticated
index 1572a895ec0bb308e4c8a81ff0251b32e948921a..7a1e5628eccd63fb2c242945a18e08fdbc348750 100644 (file)
@@ -2000,6 +2000,7 @@ defmodule Pleroma.User do
     %User{
       invisible: true,
       local: true,
+      actor_type: "Application",
       ap_id: uri,
       nickname: nickname,
       follower_address: uri <> "/followers"
diff --git a/priv/repo/migrations/20230202154409_instance_actors_to_actor_type_application.exs b/priv/repo/migrations/20230202154409_instance_actors_to_actor_type_application.exs
new file mode 100644 (file)
index 0000000..5bf1070
--- /dev/null
@@ -0,0 +1,21 @@
+defmodule Pleroma.Repo.Migrations.InstanceActorsToActorTypeApplication do
+  use Ecto.Migration
+
+  def up do
+    execute("""
+    update users
+    set actor_type = 'Application'
+    where local
+    and (ap_id like '%/relay' or ap_id like '%/internal/fetch')
+    """)
+  end
+
+  def down do
+    execute("""
+    update users
+    set actor_type = 'Person'
+    where local
+    and (ap_id like '%/relay' or ap_id like '%/internal/fetch')
+    """)
+  end
+end
index d6de7d61e9a5832c45e5e5013ef91c36129aa6f7..0bbfc316b905fabc7aba7292441cdccf46aa9f48 100644 (file)
@@ -19,6 +19,12 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do
     assert user.ap_id == "#{Pleroma.Web.Endpoint.url()}/relay"
   end
 
+  test "relay actor is an application" do
+    # See <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-application>
+    user = Relay.get_actor()
+    assert user.actor_type == "Application"
+  end
+
   test "relay actor is invisible" do
     user = Relay.get_actor()
     assert User.invisible?(user)