### Changed
- - **Breaking:** Removed the toggle_activated mix task
+ - **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm`
+ - **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed`
+ - **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved`
++- **Breaking**: AdminAPI changed User field `deactivated` to `is_active`
- Polls now always return a `voters_count`, even if they are single-choice.
- Admin Emails: The ap id is used as the user link in emails now.
- Improved registration workflow for email confirmation and account approval modes.
Pleroma.User.Query.build(%{
local: true,
- deactivated: false,
+ is_active: true,
- confirmation_pending: true,
+ is_confirmed: false,
invisible: false
})
|> Pleroma.Repo.chunk_stream(500)
@doc "Returns status account"
@spec account_status(User.t()) :: account_status()
- def account_status(%User{deactivated: true}), do: :deactivated
+ def account_status(%User{is_active: false}), do: :deactivated
def account_status(%User{password_reset_pending: true}), do: :password_reset_pending
- def account_status(%User{local: true, approval_pending: true}), do: :approval_pending
+ def account_status(%User{local: true, is_approved: false}), do: :approval_pending
- def account_status(%User{local: true, confirmation_pending: true}) do
+ def account_status(%User{local: true, is_confirmed: false}) do
if Config.get([:instance, :account_activation_required]) do
:confirmation_pending
else
defp compose_query({:external, _}, query), do: location_query(query, false)
defp compose_query({:active, _}, query) do
- User.restrict_deactivated(query)
+ where(query, [u], u.is_active == true)
- |> where([u], u.approval_pending == false)
+ |> where([u], u.is_approved == true)
end
defp compose_query({:legacy_active, _}, query) do
test "Sends confirmation emails" do
local_user1 =
insert(:user, %{
- confirmation_pending: true,
+ is_confirmed: false,
confirmation_token: "mytoken",
- deactivated: false,
+ is_active: true,
email: "local1@pleroma.com",
local: true
})
local_user2 =
insert(:user, %{
- confirmation_pending: true,
+ is_confirmed: false,
confirmation_token: "mytoken",
- deactivated: false,
+ is_active: true,
email: "local2@pleroma.com",
local: true
})
test "Does not send confirmation email to inappropriate users" do
# confirmed user
insert(:user, %{
- confirmation_pending: false,
+ is_confirmed: true,
confirmation_token: "mytoken",
- deactivated: false,
+ is_active: true,
email: "confirmed@pleroma.com",
local: true
})
end
test "returns :deactivated for deactivated user" do
- user = insert(:user, local: true, confirmation_pending: false, is_active: false)
- user = insert(:user, local: true, is_confirmed: true, deactivated: true)
++ user = insert(:user, local: true, is_confirmed: true, is_active: false)
assert User.account_status(user) == :deactivated
end
assert account["id"] == actor.id
assert account["nickname"] == actor.nickname
- assert account["deactivated"] == actor.deactivated
+ assert account["is_active"] == actor.is_active
- assert account["confirmation_pending"] == actor.confirmation_pending
+ assert account["is_confirmed"] == actor.is_confirmed
end
end