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(:last_digest_emailed_at, :naive_datetime)
field(:banner, :map, default: %{}) field(:banner, :map, default: %{})
field(:background, :map, default: %{}) field(:background, :map, default: %{})
field(:source_data, :map, default: %{})
field(:note_count, :integer, default: 0) field(:note_count, :integer, default: 0)
field(:follower_count, :integer, default: 0) field(:follower_count, :integer, default: 0)
field(:following_count, :integer, default: 0) field(:following_count, :integer, default: 0)
@ -377,7 +376,6 @@ defmodule Pleroma.User do
:public_key, :public_key,
:avatar, :avatar,
:ap_enabled, :ap_enabled,
:source_data,
:banner, :banner,
:locked, :locked,
:magic_key, :magic_key,
@ -536,7 +534,6 @@ defmodule Pleroma.User do
:avatar, :avatar,
:last_refreshed_at, :last_refreshed_at,
:ap_enabled, :ap_enabled,
:source_data,
:banner, :banner,
:locked, :locked,
:magic_key, :magic_key,

View File

@ -1459,7 +1459,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
ap_id: data["id"], ap_id: data["id"],
uri: get_actor_url(data["url"]), uri: get_actor_url(data["url"]),
ap_enabled: true, ap_enabled: true,
source_data: data,
banner: banner, banner: banner,
fields: fields, fields: fields,
emoji: emojis, 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 @@ defmodule Pleroma.UserTest do
{:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/users/admin") {: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 refute user.last_refreshed_at == orig_user.last_refreshed_at
end end

View File

@ -180,7 +180,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
{:ok, user} = ActivityPub.make_user_from_ap_id(user_id) {:ok, user} = ActivityPub.make_user_from_ap_id(user_id)
assert user.ap_id == user_id assert user.ap_id == user_id
assert user.nickname == "admin@mastodon.example.org" assert user.nickname == "admin@mastodon.example.org"
assert user.source_data
assert user.ap_enabled assert user.ap_enabled
assert user.follower_address == "http://mastodon.example.org/users/admin/followers" assert user.follower_address == "http://mastodon.example.org/users/admin/followers"
end end