User: remove source_data

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-04-06 10:59:35 +02:00
parent 3420dec494
commit e89078ac2a
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
5 changed files with 16 additions and 6 deletions

View 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 @@ def remote_user_creation(params) do
:public_key,
:avatar,
:ap_enabled,
:source_data,
:banner,
:locked,
:magic_key,
@ -536,7 +534,6 @@ def upgrade_changeset(struct, params \\ %{}, remote? \\ false) do
:avatar,
:last_refreshed_at,
:ap_enabled,
:source_data,
:banner,
:locked,
:magic_key,

View file

@ -1459,7 +1459,6 @@ defp object_to_user_data(data) do
ap_id: data["id"],
uri: get_actor_url(data["url"]),
ap_enabled: true,
source_data: data,
banner: banner,
fields: fields,
emoji: emojis,

View file

@ -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

View file

@ -581,7 +581,7 @@ test "updates an existing user, if stale" 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

View file

@ -180,7 +180,6 @@ test "it returns a user" 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