has_many(:registrations, Registration)
has_many(:deliveries, Delivery)
- field(:info, :map, default: %{})
-
timestamps()
end
params =
params
- |> Map.put(:info, params[:info] || %{})
|> truncate_if_exists(:name, name_limit)
|> truncate_if_exists(:bio, bio_limit)
|> truncate_fields_param()
def external_users(opts \\ []) do
query =
external_users_query()
- |> select([u], struct(u, [:id, :ap_id, :info]))
+ |> select([u], struct(u, [:id, :ap_id]))
query =
if opts[:max_id],
nickname: sequence(:nickname, &"nick#{&1}"),
password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
bio: sequence(:bio, &"Tester Number #{&1}"),
- info: %{},
last_digest_emailed_at: NaiveDateTime.utc_now()
}
assert changeset.changes.follower_address == "#{changeset.changes.ap_id}/followers"
end
-
- test "it ensures info is not nil" do
- changeset = User.register_changeset(%User{}, @full_user_data)
-
- assert changeset.valid?
-
- {:ok, user} =
- changeset
- |> Repo.insert()
-
- refute is_nil(user.info)
- end
end
describe "user registration, with :account_activation_required" do
:user,
local: false,
nickname: "admin@mastodon.example.org",
- ap_id: ap_id,
- info: %{}
+ ap_id: ap_id
)
{:ok, fetched_user} = User.get_or_fetch(ap_id)
local: false,
nickname: "admin@mastodon.example.org",
ap_id: "http://mastodon.example.org/users/admin",
- last_refreshed_at: a_week_ago,
- info: %{}
+ last_refreshed_at: a_week_ago
)
assert orig_user.last_refreshed_at == a_week_ago
name: "Someone",
nickname: "a@b.de",
ap_id: "http...",
- info: %{some: "info"},
avatar: %{some: "avatar"}
}
ap_id: user.ap_id,
name: user.name,
nickname: user.nickname,
- bio: String.duplicate("h", current_max_length + 1),
- info: %{}
+ bio: String.duplicate("h", current_max_length + 1)
}
assert {:ok, %User{}} = User.insert_or_update_user(data)
data = %{
ap_id: user.ap_id,
name: String.duplicate("h", current_max_length + 1),
- nickname: user.nickname,
- info: %{}
+ nickname: user.nickname
}
assert {:ok, %User{}} = User.insert_or_update_user(data)