User: remove source_data
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Mon, 6 Apr 2020 08:59:35 +0000 (10:59 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 10 Apr 2020 04:20:03 +0000 (06:20 +0200)
lib/pleroma/user.ex
lib/pleroma/web/activity_pub/activity_pub.ex
priv/repo/migrations/20200406105422_users_remove_source_data.exs [new file with mode: 0644]
test/user_test.exs
test/web/activity_pub/activity_pub_test.exs

index 79e9b2c864b3ab9bc9cc7bc43e2380bb5071bc6b..d05dfb480e596ccce95df22e72470bac67feb344 100644 (file)
@@ -97,7 +97,6 @@ defmodule Pleroma.User do
     field(:last_digest_emailed_at, :naive_datetime)
     field(:banner, :map, default: %{})
     field(:background, :map, default: %{})
-    field(:source_data, :map, default: %{})
     field(:note_count, :integer, default: 0)
     field(:follower_count, :integer, default: 0)
     field(:following_count, :integer, default: 0)
@@ -377,7 +376,6 @@ defmodule Pleroma.User do
         :public_key,
         :avatar,
         :ap_enabled,
-        :source_data,
         :banner,
         :locked,
         :magic_key,
@@ -536,7 +534,6 @@ defmodule Pleroma.User do
         :avatar,
         :last_refreshed_at,
         :ap_enabled,
-        :source_data,
         :banner,
         :locked,
         :magic_key,
index 63502b4844db6d0d22075adcff986f3fa76b2b5e..9b832f4cb357e79a9b176d414c233da08e630cc4 100644 (file)
@@ -1459,7 +1459,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
       ap_id: data["id"],
       uri: get_actor_url(data["url"]),
       ap_enabled: true,
-      source_data: data,
       banner: banner,
       fields: fields,
       emoji: emojis,
diff --git a/priv/repo/migrations/20200406105422_users_remove_source_data.exs b/priv/repo/migrations/20200406105422_users_remove_source_data.exs
new file mode 100644 (file)
index 0000000..9812d48
--- /dev/null
@@ -0,0 +1,15 @@
+defmodule Pleroma.Repo.Migrations.UsersRemoveSourceData do
+  use Ecto.Migration
+
+  def up do
+    alter table(:users) do
+      remove_if_exists(:source_data, :map)
+    end
+  end
+
+  def down do
+    alter table(:users) do
+      add_if_not_exists(:source_data, :map, default: %{})
+    end
+  end
+end
index d39787f35d5d00480b786e6619652295f610ee6e..d350053539295d75cb0c27618c093f3ccc7d9613 100644 (file)
@@ -581,7 +581,7 @@ defmodule Pleroma.UserTest do
 
       {:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/users/admin")
 
-      assert user.source_data["endpoints"]
+      assert user.inbox
 
       refute user.last_refreshed_at == orig_user.last_refreshed_at
     end
index 17e7b97deffcbfe93c7eeeabd7550e4dea6c1e2b..6410df49bb4d78a5e16e3b2ff217cc5014c0a33d 100644 (file)
@@ -180,7 +180,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
       {:ok, user} = ActivityPub.make_user_from_ap_id(user_id)
       assert user.ap_id == user_id
       assert user.nickname == "admin@mastodon.example.org"
-      assert user.source_data
       assert user.ap_enabled
       assert user.follower_address == "http://mastodon.example.org/users/admin/followers"
     end