Merge branch 'develop' into refactor/deactivated_user_field

This commit is contained in:
Mark Felder 2021-01-18 14:58:21 -06:00
commit 28581e03ad
106 changed files with 230 additions and 194 deletions

View File

@ -8,11 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed ### 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. - 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. - Admin Emails: The ap id is used as the user link in emails now.
- Improved registration workflow for email confirmation and account approval modes. - Improved registration workflow for email confirmation and account approval modes.
- **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm`
- Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries. - Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries.
- Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators. - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators.
- Admin API: Reports now ordered by newest - Admin API: Reports now ordered by newest
@ -41,6 +43,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute. - Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute.
- Admin API: An endpoint to manage frontends. - Admin API: An endpoint to manage frontends.
- Streaming API: Add follow relationships updates. - Streaming API: Add follow relationships updates.
- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types
</details> </details>
### Fixed ### Fixed
@ -58,9 +61,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased (Patch) ## Unreleased (Patch)
### Fixed ### Fixed
- Fix ability to update Pleroma Chat push notifications with PUT /api/v1/push/subscription and alert type pleroma:chat_mention
- Emoji Reaction activity filtering from blocked and muted accounts.
- StealEmojiPolicy creates dir for emojis, if it doesn't exist. - StealEmojiPolicy creates dir for emojis, if it doesn't exist.
## [2.2.1] - 2020-12-22 ## [2.2.1] - 2020-12-22
@ -77,6 +77,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Rich Media Previews sometimes showed the wrong preview due to a bug following redirects. - Rich Media Previews sometimes showed the wrong preview due to a bug following redirects.
- Fixes for the autolinker. - Fixes for the autolinker.
- Forwarded reports duplication from Pleroma instances. - Forwarded reports duplication from Pleroma instances.
- Emoji Reaction activity filtering from blocked and muted accounts.
- <details> - <details>
<summary>API</summary> <summary>API</summary>

View File

@ -542,7 +542,7 @@
scheduled_activities: 10, scheduled_activities: 10,
background: 5, background: 5,
remote_fetcher: 2, remote_fetcher: 2,
attachments_cleanup: 5, attachments_cleanup: 1,
new_users_digest: 1, new_users_digest: 1,
mute_expire: 5 mute_expire: 5
], ],

View File

@ -34,7 +34,7 @@ def run(["resend_confirmation_emails"]) do
Pleroma.User.Query.build(%{ Pleroma.User.Query.build(%{
local: true, local: true,
is_active: true, is_active: true,
confirmation_pending: true, is_confirmed: false,
invisible: false invisible: false
}) })
|> Pleroma.Repo.chunk_stream(500) |> Pleroma.Repo.chunk_stream(500)

View File

@ -74,7 +74,7 @@ def run(["new", nickname, email | rest]) do
bio: bio bio: bio
} }
changeset = User.register_changeset(%User{}, params, need_confirmation: false) changeset = User.register_changeset(%User{}, params, is_confirmed: true)
{:ok, _user} = User.register(changeset) {:ok, _user} = User.register(changeset)
shell_info("User #{nickname} created") shell_info("User #{nickname} created")
@ -198,7 +198,7 @@ def run(["set", nickname | rest]) do
user = user =
case Keyword.get(options, :confirmed) do case Keyword.get(options, :confirmed) do
nil -> user nil -> user
value -> set_confirmed(user, value) value -> set_confirmation(user, value)
end end
user = user =
@ -336,7 +336,7 @@ def run(["confirm", nickname]) do
with %User{} = user <- User.get_cached_by_nickname(nickname) do with %User{} = user <- User.get_cached_by_nickname(nickname) do
{:ok, user} = User.confirm(user) {:ok, user} = User.confirm(user)
message = if user.confirmation_pending, do: "needs", else: "doesn't need" message = if !user.is_confirmed, do: "needs", else: "doesn't need"
shell_info("#{nickname} #{message} confirmation.") shell_info("#{nickname} #{message} confirmation.")
else else
@ -358,7 +358,7 @@ def run(["confirm_all"]) do
|> Pleroma.Repo.chunk_stream(500, :batches) |> Pleroma.Repo.chunk_stream(500, :batches)
|> Stream.each(fn users -> |> Stream.each(fn users ->
users users
|> Enum.each(fn user -> User.need_confirmation(user, false) end) |> Enum.each(fn user -> User.set_confirmation(user, true) end)
end) end)
|> Stream.run() |> Stream.run()
end end
@ -376,7 +376,7 @@ def run(["unconfirm_all"]) do
|> Pleroma.Repo.chunk_stream(500, :batches) |> Pleroma.Repo.chunk_stream(500, :batches)
|> Stream.each(fn users -> |> Stream.each(fn users ->
users users
|> Enum.each(fn user -> User.need_confirmation(user, true) end) |> Enum.each(fn user -> User.set_confirmation(user, false) end)
end) end)
|> Stream.run() |> Stream.run()
end end
@ -439,10 +439,10 @@ defp set_locked(user, value) do
user user
end end
defp set_confirmed(user, value) do defp set_confirmation(user, value) do
{:ok, user} = User.need_confirmation(user, !value) {:ok, user} = User.set_confirmation(user, value)
shell_info("Confirmation pending status of #{user.nickname}: #{user.confirmation_pending}") shell_info("Confirmation status of #{user.nickname}: #{user.is_confirmed}")
user user
end end
end end

View File

@ -110,9 +110,9 @@ defmodule Pleroma.User do
field(:follower_count, :integer, default: 0) field(:follower_count, :integer, default: 0)
field(:following_count, :integer, default: 0) field(:following_count, :integer, default: 0)
field(:is_locked, :boolean, default: false) field(:is_locked, :boolean, default: false)
field(:confirmation_pending, :boolean, default: false) field(:is_confirmed, :boolean, default: true)
field(:password_reset_pending, :boolean, default: false) field(:password_reset_pending, :boolean, default: false)
field(:approval_pending, :boolean, default: false) field(:is_approved, :boolean, default: true)
field(:registration_reason, :string, default: nil) field(:registration_reason, :string, default: nil)
field(:confirmation_token, :string, default: nil) field(:confirmation_token, :string, default: nil)
field(:default_scope, :string, default: "public") field(:default_scope, :string, default: "public")
@ -289,9 +289,9 @@ def binary_id(%User{} = user), do: binary_id(user.id)
@spec account_status(User.t()) :: account_status() @spec account_status(User.t()) :: account_status()
def account_status(%User{is_active: false}), 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{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 if Config.get([:instance, :account_activation_required]) do
:confirmation_pending :confirmation_pending
else else
@ -700,23 +700,23 @@ def register_changeset(struct, params \\ %{}, opts \\ []) do
reason_limit = Config.get([:instance, :registration_reason_length], 500) reason_limit = Config.get([:instance, :registration_reason_length], 500)
params = Map.put_new(params, :accepts_chat_messages, true) params = Map.put_new(params, :accepts_chat_messages, true)
need_confirmation? = confirmed? =
if is_nil(opts[:need_confirmation]) do if is_nil(opts[:confirmed]) do
Config.get([:instance, :account_activation_required]) !Config.get([:instance, :account_activation_required])
else else
opts[:need_confirmation] opts[:confirmed]
end end
need_approval? = approved? =
if is_nil(opts[:need_approval]) do if is_nil(opts[:approved]) do
Config.get([:instance, :account_approval_required]) !Config.get([:instance, :account_approval_required])
else else
opts[:need_approval] opts[:approved]
end end
struct struct
|> confirmation_changeset(need_confirmation: need_confirmation?) |> confirmation_changeset(set_confirmation: confirmed?)
|> approval_changeset(need_approval: need_approval?) |> approval_changeset(set_approval: approved?)
|> cast(params, [ |> cast(params, [
:bio, :bio,
:raw_bio, :raw_bio,
@ -804,20 +804,20 @@ def register(%Ecto.Changeset{} = changeset) do
end end
end end
def post_register_action(%User{confirmation_pending: true} = user) do def post_register_action(%User{is_confirmed: false} = user) do
with {:ok, _} <- try_send_confirmation_email(user) do with {:ok, _} <- try_send_confirmation_email(user) do
{:ok, user} {:ok, user}
end end
end end
def post_register_action(%User{approval_pending: true} = user) do def post_register_action(%User{is_approved: false} = user) do
with {:ok, _} <- send_user_approval_email(user), with {:ok, _} <- send_user_approval_email(user),
{:ok, _} <- send_admin_approval_emails(user) do {:ok, _} <- send_admin_approval_emails(user) do
{:ok, user} {:ok, user}
end end
end end
def post_register_action(%User{approval_pending: false, confirmation_pending: false} = user) do def post_register_action(%User{is_approved: true, is_confirmed: true} = user) do
with {:ok, user} <- autofollow_users(user), with {:ok, user} <- autofollow_users(user),
{:ok, _} <- autofollowing_users(user), {:ok, _} <- autofollowing_users(user),
{:ok, user} <- set_cache(user), {:ok, user} <- set_cache(user),
@ -878,7 +878,7 @@ def send_welcome_email(%User{email: email} = user) when is_binary(email) do
def send_welcome_email(_), do: {:ok, :noop} def send_welcome_email(_), do: {:ok, :noop}
@spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop} @spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
def try_send_confirmation_email(%User{confirmation_pending: true, email: email} = user) def try_send_confirmation_email(%User{is_confirmed: false, email: email} = user)
when is_binary(email) do when is_binary(email) do
if Config.get([:instance, :account_activation_required]) do if Config.get([:instance, :account_activation_required]) do
send_confirmation_email(user) send_confirmation_email(user)
@ -1620,8 +1620,8 @@ def approve(users) when is_list(users) do
end) end)
end end
def approve(%User{approval_pending: true} = user) do def approve(%User{is_approved: false} = user) do
with chg <- change(user, approval_pending: false), with chg <- change(user, is_approved: true),
{:ok, user} <- update_and_set_cache(chg) do {:ok, user} <- update_and_set_cache(chg) do
post_register_action(user) post_register_action(user)
{:ok, user} {:ok, user}
@ -1638,8 +1638,8 @@ def confirm(users) when is_list(users) do
end) end)
end end
def confirm(%User{confirmation_pending: true} = user) do def confirm(%User{is_confirmed: false} = user) do
with chg <- confirmation_changeset(user, need_confirmation: false), with chg <- confirmation_changeset(user, set_confirmation: true),
{:ok, user} <- update_and_set_cache(chg) do {:ok, user} <- update_and_set_cache(chg) do
post_register_action(user) post_register_action(user)
{:ok, user} {:ok, user}
@ -1678,9 +1678,9 @@ def purge_user_changeset(user) do
follower_count: 0, follower_count: 0,
following_count: 0, following_count: 0,
is_locked: false, is_locked: false,
confirmation_pending: false, is_confirmed: true,
password_reset_pending: false, password_reset_pending: false,
approval_pending: false, is_approved: true,
registration_reason: nil, registration_reason: nil,
confirmation_token: nil, confirmation_token: nil,
domain_blocks: [], domain_blocks: [],
@ -2134,10 +2134,10 @@ def touch_last_digest_emailed_at(user) do
updated_user updated_user
end end
@spec need_confirmation(User.t(), boolean()) :: {:ok, User.t()} | {:error, Changeset.t()} @spec set_confirmation(User.t(), boolean()) :: {:ok, User.t()} | {:error, Changeset.t()}
def need_confirmation(%User{} = user, bool) do def set_confirmation(%User{} = user, bool) do
user user
|> confirmation_changeset(need_confirmation: bool) |> confirmation_changeset(set_confirmation: bool)
|> update_and_set_cache() |> update_and_set_cache()
end end
@ -2305,27 +2305,26 @@ def mastodon_settings_update(user, settings) do
end end
@spec confirmation_changeset(User.t(), keyword()) :: Changeset.t() @spec confirmation_changeset(User.t(), keyword()) :: Changeset.t()
def confirmation_changeset(user, need_confirmation: need_confirmation?) do def confirmation_changeset(user, set_confirmation: confirmed?) do
params = params =
if need_confirmation? do if confirmed? do
%{ %{
confirmation_pending: true, is_confirmed: true,
confirmation_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64() confirmation_token: nil
} }
else else
%{ %{
confirmation_pending: false, is_confirmed: false,
confirmation_token: nil confirmation_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64()
} }
end end
cast(user, params, [:confirmation_pending, :confirmation_token]) cast(user, params, [:is_confirmed, :confirmation_token])
end end
@spec approval_changeset(User.t(), keyword()) :: Changeset.t() @spec approval_changeset(User.t(), keyword()) :: Changeset.t()
def approval_changeset(user, need_approval: need_approval?) do def approval_changeset(user, set_approval: approved?) do
params = if need_approval?, do: %{approval_pending: true}, else: %{approval_pending: false} cast(user, %{is_approved: approved?}, [:is_approved])
cast(user, params, [:approval_pending])
end end
def add_pinnned_activity(user, %Pleroma.Activity{id: id}) do def add_pinnned_activity(user, %Pleroma.Activity{id: id}) do

View File

@ -138,7 +138,7 @@ defp compose_query({:external, _}, query), do: location_query(query, false)
defp compose_query({:active, _}, query) do defp compose_query({:active, _}, query) do
where(query, [u], u.is_active == true) where(query, [u], u.is_active == true)
|> where([u], u.approval_pending == false) |> where([u], u.is_approved == true)
end end
defp compose_query({:legacy_active, _}, query) do defp compose_query({:legacy_active, _}, query) do
@ -155,15 +155,15 @@ defp compose_query({:deactivated, true}, query) do
end end
defp compose_query({:confirmation_pending, bool}, query) do defp compose_query({:confirmation_pending, bool}, query) do
where(query, [u], u.confirmation_pending == ^bool) where(query, [u], u.is_confirmed != ^bool)
end end
defp compose_query({:need_approval, _}, query) do defp compose_query({:need_approval, _}, query) do
where(query, [u], u.approval_pending) where(query, [u], u.is_approved == false)
end end
defp compose_query({:unconfirmed, _}, query) do defp compose_query({:unconfirmed, _}, query) do
where(query, [u], u.confirmation_pending) where(query, [u], u.is_confirmed == false)
end end
defp compose_query({:followers, %User{id: id}}, query) do defp compose_query({:followers, %User{id: id}}, query) do

View File

@ -77,8 +77,8 @@ def render("show.json", %{user: user}) do
"local" => user.local, "local" => user.local,
"roles" => User.roles(user), "roles" => User.roles(user),
"tags" => user.tags || [], "tags" => user.tags || [],
"confirmation_pending" => user.confirmation_pending, "is_confirmed" => user.is_confirmed,
"approval_pending" => user.approval_pending, "is_approved" => user.is_approved,
"url" => user.uri || user.ap_id, "url" => user.uri || user.ap_id,
"registration_reason" => user.registration_reason, "registration_reason" => user.registration_reason,
"actor_type" => user.actor_type "actor_type" => user.actor_type

View File

@ -191,7 +191,7 @@ defp account_admin do
moderator: %Schema{type: :boolean} moderator: %Schema{type: :boolean}
} }
}, },
confirmation_pending: %Schema{type: :boolean} is_confirmed: %Schema{type: :boolean}
}) })
} }
end end

View File

@ -142,7 +142,7 @@ def admin_account do
} }
}, },
tags: %Schema{type: :string}, tags: %Schema{type: :string},
confirmation_pending: %Schema{type: :string} is_confirmed: %Schema{type: :string}
} }
} }
end end

View File

@ -236,7 +236,7 @@ def chats_response do
"account" => %{ "account" => %{
"pleroma" => %{ "pleroma" => %{
"is_admin" => false, "is_admin" => false,
"confirmation_pending" => false, "is_confirmed" => true,
"hide_followers_count" => false, "hide_followers_count" => false,
"is_moderator" => false, "is_moderator" => false,
"hide_favorites" => true, "hide_favorites" => true,

View File

@ -48,7 +48,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
}, },
background_image: %Schema{type: :string, nullable: true, format: :uri}, background_image: %Schema{type: :string, nullable: true, format: :uri},
chat_token: %Schema{type: :string}, chat_token: %Schema{type: :string},
confirmation_pending: %Schema{ is_confirmed: %Schema{
type: :boolean, type: :boolean,
description: description:
"whether the user account is waiting on email confirmation to be activated" "whether the user account is waiting on email confirmation to be activated"
@ -166,7 +166,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
"pleroma" => %{ "pleroma" => %{
"allow_following_move" => true, "allow_following_move" => true,
"background_image" => nil, "background_image" => nil,
"confirmation_pending" => true, "is_confirmed" => false,
"hide_favorites" => true, "hide_favorites" => true,
"hide_followers" => false, "hide_followers" => false,
"hide_followers_count" => false, "hide_followers_count" => false,

View File

@ -23,7 +23,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Chat do
"account" => %{ "account" => %{
"pleroma" => %{ "pleroma" => %{
"is_admin" => false, "is_admin" => false,
"confirmation_pending" => false, "is_confirmed" => true,
"hide_followers_count" => false, "hide_followers_count" => false,
"is_moderator" => false, "is_moderator" => false,
"hide_favorites" => true, "hide_favorites" => true,

View File

@ -256,7 +256,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
"note" => "Tester Number 6", "note" => "Tester Number 6",
"pleroma" => %{ "pleroma" => %{
"background_image" => nil, "background_image" => nil,
"confirmation_pending" => false, "is_confirmed" => true,
"hide_favorites" => true, "hide_favorites" => true,
"hide_followers" => false, "hide_followers" => false,
"hide_followers_count" => false, "hide_followers_count" => false,

View File

@ -84,7 +84,7 @@ def create_from_registration(
password_confirmation: random_password password_confirmation: random_password
}, },
external: true, external: true,
need_confirmation: false confirmed: true
) )
|> Repo.insert(), |> Repo.insert(),
{:ok, _} <- {:ok, _} <-

View File

@ -266,7 +266,7 @@ defp do_render("show.json", %{user: user} = opts) do
pleroma: %{ pleroma: %{
ap_id: user.ap_id, ap_id: user.ap_id,
also_known_as: user.also_known_as, also_known_as: user.also_known_as,
confirmation_pending: user.confirmation_pending, is_confirmed: user.is_confirmed,
tags: user.tags, tags: user.tags,
hide_followers_count: user.hide_followers_count, hide_followers_count: user.hide_followers_count,
hide_follows_count: user.hide_follows_count, hide_follows_count: user.hide_follows_count,

View File

@ -30,7 +30,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
def confirm_email(conn, %{"user_id" => uid, "token" => token}) do def confirm_email(conn, %{"user_id" => uid, "token" => token}) do
with %User{} = user <- User.get_cached_by_id(uid), with %User{} = user <- User.get_cached_by_id(uid),
true <- user.local and user.confirmation_pending and user.confirmation_token == token, true <- user.local and !user.is_confirmed and user.confirmation_token == token,
{:ok, _} <- User.confirm(user) do {:ok, _} <- User.confirm(user) do
redirect(conn, to: "/") redirect(conn, to: "/")
end end

View File

@ -0,0 +1,20 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Repo.Migrations.RefactorConfirmationPendingUserField do
use Ecto.Migration
def up do
# Flip the values before we change the meaning of the column
execute("UPDATE users SET confirmation_pending = NOT confirmation_pending;")
execute("ALTER TABLE users RENAME COLUMN confirmation_pending TO is_confirmed;")
execute("ALTER TABLE users ALTER COLUMN is_confirmed SET DEFAULT true;")
end
def down do
execute("UPDATE users SET is_confirmed = NOT is_confirmed;")
execute("ALTER TABLE users RENAME COLUMN is_confirmed TO confirmation_pending;")
execute("ALTER TABLE users ALTER COLUMN confirmation_pending SET DEFAULT false;")
end
end

View File

@ -0,0 +1,20 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Repo.Migrations.RefactorApprovalPendingUserField do
use Ecto.Migration
def up do
# Flip the values before we change the meaning of the column
execute("UPDATE users SET approval_pending = NOT approval_pending;")
execute("ALTER TABLE users RENAME COLUMN approval_pending TO is_approved;")
execute("ALTER TABLE users ALTER COLUMN is_approved SET DEFAULT true;")
end
def down do
execute("UPDATE users SET is_approved = NOT is_approved;")
execute("ALTER TABLE users RENAME COLUMN is_approved TO approval_pending;")
execute("ALTER TABLE users ALTER COLUMN approval_pending SET DEFAULT false;")
end
end

View File

@ -11,9 +11,9 @@ defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsers do
def up do def up do
User User
|> where([u], u.confirmation_pending == true) |> where([u], u.is_confirmed == false)
|> join(:inner, [u], t in Token, on: t.user_id == u.id) |> join(:inner, [u], t in Token, on: t.user_id == u.id)
|> Repo.update_all(set: [confirmation_pending: false]) |> Repo.update_all(set: [is_confirmed: true])
end end
def down do def down do

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=renderer content=webkit><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>Admin FE</title><link rel="shortcut icon" href=favicon.ico><link href=chunk-elementUI.f77689d7.css rel=stylesheet><link href=chunk-libs.5cf7f50a.css rel=stylesheet><link href=app.6fb984d1.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=static/js/runtime.ba96836e.js></script><script type=text/javascript src=static/js/chunk-elementUI.21957ec8.js></script><script type=text/javascript src=static/js/chunk-libs.32ea9181.js></script><script type=text/javascript src=static/js/app.c67f9a2f.js></script></body></html> <!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=renderer content=webkit><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>Admin FE</title><link rel="shortcut icon" href=favicon.ico><link href=chunk-elementUI.f77689d7.css rel=stylesheet><link href=chunk-libs.5cf7f50a.css rel=stylesheet><link href=app.6fb984d1.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=static/js/runtime.5c1034c4.js></script><script type=text/javascript src=static/js/chunk-elementUI.21957ec8.js></script><script type=text/javascript src=static/js/chunk-libs.5ca2c8e8.js></script><script type=text/javascript src=static/js/app.01bfc983.js></script></body></html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -61,7 +61,7 @@ test "Sends test email with given address" do
test "Sends confirmation emails" do test "Sends confirmation emails" do
local_user1 = local_user1 =
insert(:user, %{ insert(:user, %{
confirmation_pending: true, is_confirmed: false,
confirmation_token: "mytoken", confirmation_token: "mytoken",
is_active: true, is_active: true,
email: "local1@pleroma.com", email: "local1@pleroma.com",
@ -70,7 +70,7 @@ test "Sends confirmation emails" do
local_user2 = local_user2 =
insert(:user, %{ insert(:user, %{
confirmation_pending: true, is_confirmed: false,
confirmation_token: "mytoken", confirmation_token: "mytoken",
is_active: true, is_active: true,
email: "local2@pleroma.com", email: "local2@pleroma.com",
@ -88,7 +88,7 @@ test "Sends confirmation emails" do
test "Does not send confirmation email to inappropriate users" do test "Does not send confirmation email to inappropriate users" do
# confirmed user # confirmed user
insert(:user, %{ insert(:user, %{
confirmation_pending: false, is_confirmed: true,
confirmation_token: "mytoken", confirmation_token: "mytoken",
is_active: true, is_active: true,
email: "confirmed@pleroma.com", email: "confirmed@pleroma.com",

View File

@ -205,7 +205,7 @@ test "All statuses set" do
assert message =~ ~r/Admin status .* true/ assert message =~ ~r/Admin status .* true/
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message =~ ~r/Confirmation pending .* false/ assert message =~ ~r/Confirmation status.* true/
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message =~ ~r/Locked status .* true/ assert message =~ ~r/Locked status .* true/
@ -217,7 +217,7 @@ test "All statuses set" do
assert user.is_moderator assert user.is_moderator
assert user.is_locked assert user.is_locked
assert user.is_admin assert user.is_admin
refute user.confirmation_pending assert user.is_confirmed
end end
test "All statuses unset" do test "All statuses unset" do
@ -226,7 +226,7 @@ test "All statuses unset" do
is_locked: true, is_locked: true,
is_moderator: true, is_moderator: true,
is_admin: true, is_admin: true,
confirmation_pending: true is_confirmed: false
) )
Mix.Tasks.Pleroma.User.run([ Mix.Tasks.Pleroma.User.run([
@ -242,7 +242,7 @@ test "All statuses unset" do
assert message =~ ~r/Admin status .* false/ assert message =~ ~r/Admin status .* false/
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message =~ ~r/Confirmation pending .* true/ assert message =~ ~r/Confirmation status.* false/
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message =~ ~r/Locked status .* false/ assert message =~ ~r/Locked status .* false/
@ -254,7 +254,7 @@ test "All statuses unset" do
refute user.is_moderator refute user.is_moderator
refute user.is_locked refute user.is_locked
refute user.is_admin refute user.is_admin
assert user.confirmation_pending refute user.is_confirmed
end end
test "no user to set status" do test "no user to set status" do
@ -403,13 +403,6 @@ test "invite is revoked" do
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message =~ "Invite for token #{invite.token} was revoked." assert message =~ "Invite for token #{invite.token} was revoked."
end end
test "it prints an error message when invite is not exist" do
Mix.Tasks.Pleroma.User.run(["revoke_invite", "foo"])
assert_received {:mix_shell, :error, [message]}
assert message =~ "No invite found"
end
end end
describe "running delete_activities" do describe "running delete_activities" do
@ -431,27 +424,27 @@ test "it prints an error message when user is not exist" do
describe "running confirm" do describe "running confirm" do
test "user is confirmed" do test "user is confirmed" do
%{id: id, nickname: nickname} = insert(:user, confirmation_pending: false) %{id: id, nickname: nickname} = insert(:user, is_confirmed: true)
assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname]) assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname])
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message == "#{nickname} doesn't need confirmation." assert message == "#{nickname} doesn't need confirmation."
user = Repo.get(User, id) user = Repo.get(User, id)
refute user.confirmation_pending assert user.is_confirmed
refute user.confirmation_token refute user.confirmation_token
end end
test "user is not confirmed" do test "user is not confirmed" do
%{id: id, nickname: nickname} = %{id: id, nickname: nickname} =
insert(:user, confirmation_pending: true, confirmation_token: "some token") insert(:user, is_confirmed: false, confirmation_token: "some token")
assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname]) assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname])
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message == "#{nickname} doesn't need confirmation." assert message == "#{nickname} doesn't need confirmation."
user = Repo.get(User, id) user = Repo.get(User, id)
refute user.confirmation_pending assert user.is_confirmed
refute user.confirmation_token refute user.confirmation_token
end end
@ -546,29 +539,29 @@ test "it prints an error message when user is not exist" do
describe "bulk confirm and unconfirm" do describe "bulk confirm and unconfirm" do
test "confirm all" do test "confirm all" do
user1 = insert(:user, confirmation_pending: true) user1 = insert(:user, is_confirmed: false)
user2 = insert(:user, confirmation_pending: true) user2 = insert(:user, is_confirmed: false)
assert user1.confirmation_pending refute user1.is_confirmed
assert user2.confirmation_pending refute user2.is_confirmed
Mix.Tasks.Pleroma.User.run(["confirm_all"]) Mix.Tasks.Pleroma.User.run(["confirm_all"])
user1 = User.get_cached_by_nickname(user1.nickname) user1 = User.get_cached_by_nickname(user1.nickname)
user2 = User.get_cached_by_nickname(user2.nickname) user2 = User.get_cached_by_nickname(user2.nickname)
refute user1.confirmation_pending assert user1.is_confirmed
refute user2.confirmation_pending assert user2.is_confirmed
end end
test "unconfirm all" do test "unconfirm all" do
user1 = insert(:user, confirmation_pending: false) user1 = insert(:user, is_confirmed: true)
user2 = insert(:user, confirmation_pending: false) user2 = insert(:user, is_confirmed: true)
admin = insert(:user, is_admin: true, confirmation_pending: false) admin = insert(:user, is_admin: true, is_confirmed: true)
mod = insert(:user, is_moderator: true, confirmation_pending: false) mod = insert(:user, is_moderator: true, is_confirmed: true)
refute user1.confirmation_pending assert user1.is_confirmed
refute user2.confirmation_pending assert user2.is_confirmed
Mix.Tasks.Pleroma.User.run(["unconfirm_all"]) Mix.Tasks.Pleroma.User.run(["unconfirm_all"])
@ -577,10 +570,10 @@ test "unconfirm all" do
admin = User.get_cached_by_nickname(admin.nickname) admin = User.get_cached_by_nickname(admin.nickname)
mod = User.get_cached_by_nickname(mod.nickname) mod = User.get_cached_by_nickname(mod.nickname)
assert user1.confirmation_pending refute user1.is_confirmed
assert user2.confirmation_pending refute user2.is_confirmed
refute admin.confirmation_pending assert admin.is_confirmed
refute mod.confirmation_pending assert mod.is_confirmed
end end
end end
end end

View File

@ -14,12 +14,12 @@ defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsersTest do
test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: migration} do test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: migration} do
insert_list(25, :oauth_token) insert_list(25, :oauth_token)
Repo.update_all(User, set: [confirmation_pending: true]) Repo.update_all(User, set: [is_confirmed: false])
insert_list(5, :user, confirmation_pending: true) insert_list(5, :user, is_confirmed: false)
count = count =
User User
|> where(confirmation_pending: true) |> where(is_confirmed: false)
|> Repo.aggregate(:count) |> Repo.aggregate(:count)
assert count == 30 assert count == 30
@ -28,7 +28,7 @@ test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: mi
count = count =
User User
|> where(confirmation_pending: true) |> where(is_confirmed: false)
|> Repo.aggregate(:count) |> Repo.aggregate(:count)
assert count == 5 assert count == 5

View File

@ -640,7 +640,7 @@ test "it creates a confirmed user" do
{:ok, user} = Repo.insert(changeset) {:ok, user} = Repo.insert(changeset)
refute user.confirmation_pending assert user.is_confirmed
end end
end end
@ -661,17 +661,17 @@ test "it creates unconfirmed user" do
{:ok, user} = Repo.insert(changeset) {:ok, user} = Repo.insert(changeset)
assert user.confirmation_pending refute user.is_confirmed
assert user.confirmation_token assert user.confirmation_token
end end
test "it creates confirmed user if :confirmed option is given" do test "it creates confirmed user if :confirmed option is given" do
changeset = User.register_changeset(%User{}, @full_user_data, need_confirmation: false) changeset = User.register_changeset(%User{}, @full_user_data, confirmed: true)
assert changeset.valid? assert changeset.valid?
{:ok, user} = Repo.insert(changeset) {:ok, user} = Repo.insert(changeset)
refute user.confirmation_pending assert user.is_confirmed
refute user.confirmation_token refute user.confirmation_token
end end
end end
@ -694,7 +694,7 @@ test "it creates unapproved user" do
{:ok, user} = Repo.insert(changeset) {:ok, user} = Repo.insert(changeset)
assert user.approval_pending refute user.is_approved
assert user.registration_reason == "I'm a cool guy :)" assert user.registration_reason == "I'm a cool guy :)"
end end
@ -1388,17 +1388,17 @@ test "hide a user's statuses from timelines and notifications" do
describe "approve" do describe "approve" do
test "approves a user" do test "approves a user" do
user = insert(:user, approval_pending: true) user = insert(:user, is_approved: false)
assert true == user.approval_pending refute user.is_approved
{:ok, user} = User.approve(user) {:ok, user} = User.approve(user)
assert false == user.approval_pending assert user.is_approved
end end
test "approves a list of users" do test "approves a list of users" do
unapproved_users = [ unapproved_users = [
insert(:user, approval_pending: true), insert(:user, is_approved: false),
insert(:user, approval_pending: true), insert(:user, is_approved: false),
insert(:user, approval_pending: true) insert(:user, is_approved: false)
] ]
{:ok, users} = User.approve(unapproved_users) {:ok, users} = User.approve(unapproved_users)
@ -1406,7 +1406,7 @@ test "approves a list of users" do
assert Enum.count(users) == 3 assert Enum.count(users) == 3
Enum.each(users, fn user -> Enum.each(users, fn user ->
assert false == user.approval_pending assert user.is_approved
end) end)
end end
@ -1414,7 +1414,7 @@ test "it sends welcome email if it is set" do
clear_config([:welcome, :email, :enabled], true) clear_config([:welcome, :email, :enabled], true)
clear_config([:welcome, :email, :sender], "tester@test.me") clear_config([:welcome, :email, :sender], "tester@test.me")
user = insert(:user, approval_pending: true) user = insert(:user, is_approved: false)
welcome_user = insert(:user, email: "tester@test.me") welcome_user = insert(:user, email: "tester@test.me")
instance_name = Pleroma.Config.get([:instance, :name]) instance_name = Pleroma.Config.get([:instance, :name])
@ -1432,7 +1432,7 @@ test "it sends welcome email if it is set" do
test "approving an approved user does not trigger post-register actions" do test "approving an approved user does not trigger post-register actions" do
clear_config([:welcome, :email, :enabled], true) clear_config([:welcome, :email, :enabled], true)
user = insert(:user, approval_pending: false) user = insert(:user, is_approved: true)
User.approve(user) User.approve(user)
ObanHelpers.perform_all() ObanHelpers.perform_all()
@ -1443,17 +1443,17 @@ test "approving an approved user does not trigger post-register actions" do
describe "confirm" do describe "confirm" do
test "confirms a user" do test "confirms a user" do
user = insert(:user, confirmation_pending: true) user = insert(:user, is_confirmed: false)
assert true == user.confirmation_pending refute user.is_confirmed
{:ok, user} = User.confirm(user) {:ok, user} = User.confirm(user)
assert false == user.confirmation_pending assert user.is_confirmed
end end
test "confirms a list of users" do test "confirms a list of users" do
unconfirmed_users = [ unconfirmed_users = [
insert(:user, confirmation_pending: true), insert(:user, is_confirmed: false),
insert(:user, confirmation_pending: true), insert(:user, is_confirmed: false),
insert(:user, confirmation_pending: true) insert(:user, is_confirmed: false)
] ]
{:ok, users} = User.confirm(unconfirmed_users) {:ok, users} = User.confirm(unconfirmed_users)
@ -1461,13 +1461,13 @@ test "confirms a list of users" do
assert Enum.count(users) == 3 assert Enum.count(users) == 3
Enum.each(users, fn user -> Enum.each(users, fn user ->
assert false == user.confirmation_pending assert user.is_confirmed
end) end)
end end
test "sends approval emails when `approval_pending: true`" do test "sends approval emails when `is_approved: false`" do
admin = insert(:user, is_admin: true) admin = insert(:user, is_admin: true)
user = insert(:user, confirmation_pending: true, approval_pending: true) user = insert(:user, is_confirmed: false, is_approved: false)
User.confirm(user) User.confirm(user)
ObanHelpers.perform_all() ObanHelpers.perform_all()
@ -1494,7 +1494,7 @@ test "sends approval emails when `approval_pending: true`" do
end end
test "confirming a confirmed user does not trigger post-register actions" do test "confirming a confirmed user does not trigger post-register actions" do
user = insert(:user, confirmation_pending: false, approval_pending: true) user = insert(:user, is_confirmed: true, is_approved: false)
User.confirm(user) User.confirm(user)
ObanHelpers.perform_all() ObanHelpers.perform_all()
@ -1565,7 +1565,7 @@ test "it deactivates a user, all follow relationships and all activities", %{use
describe "delete/1 when confirmation is pending" do describe "delete/1 when confirmation is pending" do
setup do setup do
user = insert(:user, confirmation_pending: true) user = insert(:user, is_confirmed: false)
{:ok, user: user} {:ok, user: user}
end end
@ -1591,7 +1591,7 @@ test "deactivates user when activation is not required", %{user: user} do
end end
test "delete/1 when approval is pending deletes the user" do test "delete/1 when approval is pending deletes the user" do
user = insert(:user, approval_pending: true) user = insert(:user, is_approved: false)
{:ok, job} = User.delete(user) {:ok, job} = User.delete(user)
{:ok, _} = ObanHelpers.perform(job) {:ok, _} = ObanHelpers.perform(job)
@ -1616,9 +1616,9 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do
follower_count: 9, follower_count: 9,
following_count: 9001, following_count: 9001,
is_locked: true, is_locked: true,
confirmation_pending: true, is_confirmed: false,
password_reset_pending: true, password_reset_pending: true,
approval_pending: true, is_approved: false,
registration_reason: "ahhhhh", registration_reason: "ahhhhh",
confirmation_token: "qqqq", confirmation_token: "qqqq",
domain_blocks: ["lain.com"], domain_blocks: ["lain.com"],
@ -1658,9 +1658,9 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do
follower_count: 0, follower_count: 0,
following_count: 0, following_count: 0,
is_locked: false, is_locked: false,
confirmation_pending: false, is_confirmed: true,
password_reset_pending: false, password_reset_pending: false,
approval_pending: false, is_approved: true,
registration_reason: nil, registration_reason: nil,
confirmation_token: nil, confirmation_token: nil,
domain_blocks: [], domain_blocks: [],
@ -1729,13 +1729,13 @@ test "User.delete() plugs any possible zombie objects" do
test "return confirmation_pending for unconfirm user" do test "return confirmation_pending for unconfirm user" do
Pleroma.Config.put([:instance, :account_activation_required], true) Pleroma.Config.put([:instance, :account_activation_required], true)
user = insert(:user, confirmation_pending: true) user = insert(:user, is_confirmed: false)
assert User.account_status(user) == :confirmation_pending assert User.account_status(user) == :confirmation_pending
end end
test "return active for confirmed user" do test "return active for confirmed user" do
Pleroma.Config.put([:instance, :account_activation_required], true) Pleroma.Config.put([:instance, :account_activation_required], true)
user = insert(:user, confirmation_pending: false) user = insert(:user, is_confirmed: true)
assert User.account_status(user) == :active assert User.account_status(user) == :active
end end
@ -1750,15 +1750,15 @@ test "returns :password_reset_pending for user with reset password" do
end end
test "returns :deactivated for deactivated user" do 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, is_active: false)
assert User.account_status(user) == :deactivated assert User.account_status(user) == :deactivated
end end
test "returns :approval_pending for unapproved user" do test "returns :approval_pending for unapproved user" do
user = insert(:user, local: true, approval_pending: true) user = insert(:user, local: true, is_approved: false)
assert User.account_status(user) == :approval_pending assert User.account_status(user) == :approval_pending
user = insert(:user, local: true, confirmation_pending: true, approval_pending: true) user = insert(:user, local: true, is_confirmed: false, is_approved: false)
assert User.account_status(user) == :approval_pending assert User.account_status(user) == :approval_pending
end end
end end
@ -1815,7 +1815,7 @@ test "returns true when the account is itself" do
test "returns false when the account is unconfirmed and confirmation is required" do test "returns false when the account is unconfirmed and confirmation is required" do
Pleroma.Config.put([:instance, :account_activation_required], true) Pleroma.Config.put([:instance, :account_activation_required], true)
user = insert(:user, local: true, confirmation_pending: true) user = insert(:user, local: true, is_confirmed: false)
other_user = insert(:user, local: true) other_user = insert(:user, local: true)
refute User.visible_for(user, other_user) == :visible refute User.visible_for(user, other_user) == :visible
@ -1824,14 +1824,14 @@ test "returns false when the account is unconfirmed and confirmation is required
test "returns true when the account is unconfirmed and confirmation is required but the account is remote" do test "returns true when the account is unconfirmed and confirmation is required but the account is remote" do
Pleroma.Config.put([:instance, :account_activation_required], true) Pleroma.Config.put([:instance, :account_activation_required], true)
user = insert(:user, local: false, confirmation_pending: true) user = insert(:user, local: false, is_confirmed: false)
other_user = insert(:user, local: true) other_user = insert(:user, local: true)
assert User.visible_for(user, other_user) == :visible assert User.visible_for(user, other_user) == :visible
end end
test "returns true when the account is unconfirmed and confirmation is not required" do test "returns true when the account is unconfirmed and confirmation is not required" do
user = insert(:user, local: true, confirmation_pending: true) user = insert(:user, local: true, is_confirmed: false)
other_user = insert(:user, local: true) other_user = insert(:user, local: true)
assert User.visible_for(user, other_user) == :visible assert User.visible_for(user, other_user) == :visible
@ -1840,7 +1840,7 @@ test "returns true when the account is unconfirmed and confirmation is not requi
test "returns true when the account is unconfirmed and being viewed by a privileged account (confirmation required)" do test "returns true when the account is unconfirmed and being viewed by a privileged account (confirmation required)" do
Pleroma.Config.put([:instance, :account_activation_required], true) Pleroma.Config.put([:instance, :account_activation_required], true)
user = insert(:user, local: true, confirmation_pending: true) user = insert(:user, local: true, is_confirmed: false)
other_user = insert(:user, local: true, is_admin: true) other_user = insert(:user, local: true, is_admin: true)
assert User.visible_for(user, other_user) == :visible assert User.visible_for(user, other_user) == :visible

View File

@ -159,7 +159,7 @@ test "creates a notification", %{emoji_react: emoji_react, poster: poster} do
describe "delete users with confirmation pending" do describe "delete users with confirmation pending" do
setup do setup do
user = insert(:user, confirmation_pending: true) user = insert(:user, is_confirmed: false)
{:ok, delete_user_data, _meta} = Builder.delete(user, user.ap_id) {:ok, delete_user_data, _meta} = Builder.delete(user, user.ap_id)
{:ok, delete_user, _meta} = ActivityPub.persist(delete_user_data, local: true) {:ok, delete_user, _meta} = ActivityPub.persist(delete_user_data, local: true)
{:ok, delete: delete_user, user: user} {:ok, delete: delete_user, user: user}

View File

@ -891,10 +891,10 @@ test "GET /instances/:instance/statuses", %{conn: conn} do
describe "PATCH /confirm_email" do describe "PATCH /confirm_email" do
test "it confirms emails of two users", %{conn: conn, admin: admin} do test "it confirms emails of two users", %{conn: conn, admin: admin} do
[first_user, second_user] = insert_pair(:user, confirmation_pending: true) [first_user, second_user] = insert_pair(:user, is_confirmed: false)
assert first_user.confirmation_pending == true refute first_user.is_confirmed
assert second_user.confirmation_pending == true refute second_user.is_confirmed
ret_conn = ret_conn =
patch(conn, "/api/pleroma/admin/users/confirm_email", %{ patch(conn, "/api/pleroma/admin/users/confirm_email", %{
@ -906,8 +906,11 @@ test "it confirms emails of two users", %{conn: conn, admin: admin} do
assert ret_conn.status == 200 assert ret_conn.status == 200
assert first_user.confirmation_pending == true first_user = User.get_by_id(first_user.id)
assert second_user.confirmation_pending == true second_user = User.get_by_id(second_user.id)
assert first_user.is_confirmed
assert second_user.is_confirmed
log_entry = Repo.one(ModerationLog) log_entry = Repo.one(ModerationLog)
@ -920,7 +923,7 @@ test "it confirms emails of two users", %{conn: conn, admin: admin} do
describe "PATCH /resend_confirmation_email" do describe "PATCH /resend_confirmation_email" do
test "it resend emails for two users", %{conn: conn, admin: admin} do test "it resend emails for two users", %{conn: conn, admin: admin} do
[first_user, second_user] = insert_pair(:user, confirmation_pending: true) [first_user, second_user] = insert_pair(:user, is_confirmed: false)
ret_conn = ret_conn =
patch(conn, "/api/pleroma/admin/users/resend_confirmation_email", %{ patch(conn, "/api/pleroma/admin/users/resend_confirmation_email", %{

View File

@ -48,7 +48,7 @@ test "shows activity", %{conn: conn} do
assert account["id"] == actor.id assert account["id"] == actor.id
assert account["nickname"] == actor.nickname assert account["nickname"] == actor.nickname
assert account["is_active"] == actor.is_active assert account["is_active"] == actor.is_active
assert account["confirmation_pending"] == actor.confirmation_pending assert account["is_confirmed"] == actor.is_confirmed
end end
end end

View File

@ -429,7 +429,7 @@ test "allows to force-unfollow another user", %{admin: admin, conn: conn} do
describe "GET /api/pleroma/admin/users" do describe "GET /api/pleroma/admin/users" do
test "renders users array for the first page", %{conn: conn, admin: admin} do test "renders users array for the first page", %{conn: conn, admin: admin} do
user = insert(:user, local: false, tags: ["foo", "bar"]) user = insert(:user, local: false, tags: ["foo", "bar"])
user2 = insert(:user, approval_pending: true, registration_reason: "I'm a chill dude") user2 = insert(:user, is_approved: false, registration_reason: "I'm a chill dude")
conn = get(conn, "/api/pleroma/admin/users?page=1") conn = get(conn, "/api/pleroma/admin/users?page=1")
@ -444,7 +444,7 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do
user2, user2,
%{ %{
"local" => true, "local" => true,
"approval_pending" => true, "is_approved" => false,
"registration_reason" => "I'm a chill dude", "registration_reason" => "I'm a chill dude",
"actor_type" => "Person" "actor_type" => "Person"
} }
@ -635,11 +635,11 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do
end end
test "only unconfirmed users", %{conn: conn} do test "only unconfirmed users", %{conn: conn} do
sad_user = insert(:user, nickname: "sadboy", confirmation_pending: true) sad_user = insert(:user, nickname: "sadboy", is_confirmed: false)
old_user = insert(:user, nickname: "oldboy", confirmation_pending: true) old_user = insert(:user, nickname: "oldboy", is_confirmed: false)
insert(:user, nickname: "happyboy", approval_pending: false) insert(:user, nickname: "happyboy", is_approved: true)
insert(:user, confirmation_pending: false) insert(:user, is_confirmed: true)
result = result =
conn conn
@ -649,8 +649,8 @@ test "only unconfirmed users", %{conn: conn} do
users = users =
Enum.map([old_user, sad_user], fn user -> Enum.map([old_user, sad_user], fn user ->
user_response(user, %{ user_response(user, %{
"confirmation_pending" => true, "is_confirmed" => false,
"approval_pending" => false "is_approved" => true
}) })
end) end)
|> Enum.sort_by(& &1["nickname"]) |> Enum.sort_by(& &1["nickname"])
@ -662,18 +662,18 @@ test "only unapproved users", %{conn: conn} do
user = user =
insert(:user, insert(:user,
nickname: "sadboy", nickname: "sadboy",
approval_pending: true, is_approved: false,
registration_reason: "Plz let me in!" registration_reason: "Plz let me in!"
) )
insert(:user, nickname: "happyboy", approval_pending: false) insert(:user, nickname: "happyboy", is_approved: true)
conn = get(conn, "/api/pleroma/admin/users?filters=need_approval") conn = get(conn, "/api/pleroma/admin/users?filters=need_approval")
users = [ users = [
user_response( user_response(
user, user,
%{"approval_pending" => true, "registration_reason" => "Plz let me in!"} %{"is_approved" => false, "registration_reason" => "Plz let me in!"}
) )
] ]
@ -816,8 +816,8 @@ test "load users with tags list", %{conn: conn} do
end end
test "`active` filters out users pending approval", %{token: token} do test "`active` filters out users pending approval", %{token: token} do
insert(:user, approval_pending: true) insert(:user, is_approved: false)
%{id: user_id} = insert(:user, approval_pending: false) %{id: user_id} = insert(:user, is_approved: true)
%{id: admin_id} = token.user %{id: admin_id} = token.user
conn = conn =
@ -913,8 +913,8 @@ test "PATCH /api/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do
end end
test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do
user_one = insert(:user, approval_pending: true) user_one = insert(:user, is_approved: false)
user_two = insert(:user, approval_pending: true) user_two = insert(:user, is_approved: false)
conn = conn =
patch( patch(
@ -924,7 +924,7 @@ test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do
) )
response = json_response(conn, 200) response = json_response(conn, 200)
assert Enum.map(response["users"], & &1["approval_pending"]) == [false, false] assert Enum.map(response["users"], & &1["is_approved"]) == [true, true]
log_entry = Repo.one(ModerationLog) log_entry = Repo.one(ModerationLog)
@ -960,8 +960,8 @@ defp user_response(user, attrs \\ %{}) do
"tags" => [], "tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(), "avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname), "display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false, "is_confirmed" => true,
"approval_pending" => false, "is_approved" => true,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil, "registration_reason" => nil,
"actor_type" => "Person" "actor_type" => "Person"

View File

@ -182,7 +182,7 @@ test "it returns user by email" do
end end
test "it returns unapproved user" do test "it returns unapproved user" do
unapproved = insert(:user, approval_pending: true) unapproved = insert(:user, is_approved: false)
insert(:user) insert(:user)
insert(:user) insert(:user)
@ -193,7 +193,7 @@ test "it returns unapproved user" do
end end
test "it returns unconfirmed user" do test "it returns unconfirmed user" do
unconfirmed = insert(:user, confirmation_pending: true) unconfirmed = insert(:user, is_confirmed: false)
insert(:user) insert(:user)
insert(:user) insert(:user)

View File

@ -1027,8 +1027,8 @@ test "registers and logs in without :account_activation_required / :account_appr
user = Repo.preload(token_from_db, :user).user user = Repo.preload(token_from_db, :user).user
assert user assert user
refute user.confirmation_pending assert user.is_confirmed
refute user.approval_pending assert user.is_approved
end end
test "registers but does not log in with :account_activation_required", %{conn: conn} do test "registers but does not log in with :account_activation_required", %{conn: conn} do
@ -1088,7 +1088,7 @@ test "registers but does not log in with :account_activation_required", %{conn:
refute response["token_type"] refute response["token_type"]
user = Repo.get_by(User, email: "lain@example.org") user = Repo.get_by(User, email: "lain@example.org")
assert user.confirmation_pending refute user.is_confirmed
end end
test "registers but does not log in with :account_approval_required", %{conn: conn} do test "registers but does not log in with :account_approval_required", %{conn: conn} do
@ -1150,7 +1150,7 @@ test "registers but does not log in with :account_approval_required", %{conn: co
user = Repo.get_by(User, email: "lain@example.org") user = Repo.get_by(User, email: "lain@example.org")
assert user.approval_pending refute user.is_approved
assert user.registration_reason == "I'm a cool dude, bro" assert user.registration_reason == "I'm a cool dude, bro"
end end

Some files were not shown because too many files have changed in this diff Show More