From: Mark Felder Date: Mon, 18 Jan 2021 20:58:21 +0000 (-0600) Subject: Merge branch 'develop' into refactor/deactivated_user_field X-Git-Url: http://git.squeep.com/?a=commitdiff_plain;h=28581e03ad5761aa484a7fa427be8ab5695f0892;p=akkoma Merge branch 'develop' into refactor/deactivated_user_field --- 28581e03ad5761aa484a7fa427be8ab5695f0892 diff --cc CHANGELOG.md index 9b50d577d,50d5f80e3..f46247783 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@@ -8,7 -8,9 +8,10 @@@ The format is based on [Keep a Changelo ### 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. diff --cc lib/mix/tasks/pleroma/email.ex index 665d3b88e,6b7555fb8..e05c207e5 --- a/lib/mix/tasks/pleroma/email.ex +++ b/lib/mix/tasks/pleroma/email.ex @@@ -33,8 -33,8 +33,8 @@@ defmodule Mix.Tasks.Pleroma.Email d Pleroma.User.Query.build(%{ local: true, - deactivated: false, + is_active: true, - confirmation_pending: true, + is_confirmed: false, invisible: false }) |> Pleroma.Repo.chunk_stream(500) diff --cc lib/pleroma/user.ex index 1acb9fa18,d81abbd2b..b27923975 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@@ -287,11 -286,11 +287,11 @@@ defmodule Pleroma.User d @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 diff --cc lib/pleroma/user/query.ex index e9cf5c0e7,74ef1158a..e277f5fc2 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@@ -137,8 -137,8 +137,8 @@@ defmodule Pleroma.User.Query d 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 diff --cc test/mix/tasks/pleroma/email_test.exs index f8f941b59,ef26142c4..ce68b88de --- a/test/mix/tasks/pleroma/email_test.exs +++ b/test/mix/tasks/pleroma/email_test.exs @@@ -61,18 -61,18 +61,18 @@@ defmodule Mix.Tasks.Pleroma.EmailTest d 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 }) @@@ -88,9 -88,9 +88,9 @@@ 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 }) diff --cc test/pleroma/user_test.exs index 36fe84871,617d9b755..6449e4b4d --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@@ -1750,7 -1750,7 +1750,7 @@@ defmodule Pleroma.UserTest d 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 diff --cc test/pleroma/web/admin_api/controllers/status_controller_test.exs index 17e09a1e8,24e288c5f..3fdf23ba2 --- a/test/pleroma/web/admin_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/status_controller_test.exs @@@ -47,8 -47,8 +47,8 @@@ defmodule Pleroma.Web.AdminAPI.StatusCo 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