Merge branch 'develop' into refactor/deactivated_user_field
authorMark Felder <feld@feld.me>
Mon, 18 Jan 2021 20:58:21 +0000 (14:58 -0600)
committerMark Felder <feld@feld.me>
Mon, 18 Jan 2021 20:58:21 +0000 (14:58 -0600)
20 files changed:
1  2 
CHANGELOG.md
lib/mix/tasks/pleroma/email.ex
lib/mix/tasks/pleroma/user.ex
lib/pleroma/user.ex
lib/pleroma/user/query.ex
lib/pleroma/web/admin_api/views/account_view.ex
lib/pleroma/web/api_spec/operations/admin/report_operation.ex
lib/pleroma/web/api_spec/operations/admin/status_operation.ex
lib/pleroma/web/mastodon_api/views/account_view.ex
test/mix/tasks/pleroma/email_test.exs
test/mix/tasks/pleroma/user_test.exs
test/pleroma/user_test.exs
test/pleroma/web/activity_pub/side_effects_test.exs
test/pleroma/web/admin_api/controllers/status_controller_test.exs
test/pleroma/web/admin_api/controllers/user_controller_test.exs
test/pleroma/web/admin_api/search_test.exs
test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
test/pleroma/web/mastodon_api/views/account_view_test.exs
test/pleroma/web/o_auth/o_auth_controller_test.exs
test/pleroma/web/plugs/user_enabled_plug_test.exs

diff --cc CHANGELOG.md
index 9b50d577dfabdcd4a45b90e3b6dd41977145bd1d,50d5f80e3de012df2cf83f04059356bafdb50e32..f462477832f6544bcd1bf1f5f929cfdc5598baa2
@@@ -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.
index 665d3b88ef7557a3af40d789bc2fe83876e94d70,6b7555fb81630dea18adaf7d786099ae3f8956ab..e05c207e50c8e15494f15c672fa5b5fc4981efb1
@@@ -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)
Simple merge
index 1acb9fa187745602a61f9305d33ba13617824616,d81abbd2b7838131920d30e8a2955bdd7bf22507..b27923975161851f67adf7c768be9a427912bb6d
@@@ -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
index e9cf5c0e7c71ff9a83c0006da22ab4d3c247878c,74ef1158a3ac2db39e325b0ba2c33870125aa34b..e277f5fc2053204d184ef9d5f0faad84bd03d59c
@@@ -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
index f8f941b5973516c2c25902adca4f85d4a6b58eec,ef26142c4a830ef67c5b3b1a433b5cfe63213769..ce68b88defd08a73830275e99773c957ced8706b
@@@ -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
        })
Simple merge
index 36fe84871029ee14594c91be9691e173ddb18664,617d9b755fff0b8b6eb734382d31a3dc37c68101..6449e4b4d6697ff6d5e591f5392604518c5326b9
@@@ -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
  
index 17e09a1e84265a317145317e55b3eb9604b9f3b7,24e288c5fd281e80be89e27e864518ea7688169f..3fdf23ba2fab482c221f8eb911ac478b37dafafa
@@@ -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