Merge branch 'develop' into refactor/deactivated_user_field
This commit is contained in:
commit
28581e03ad
107 changed files with 278 additions and 242 deletions
|
|
@ -891,10 +891,10 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
|
||||
describe "PATCH /confirm_email" 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
|
||||
assert second_user.confirmation_pending == true
|
||||
refute first_user.is_confirmed
|
||||
refute second_user.is_confirmed
|
||||
|
||||
ret_conn =
|
||||
patch(conn, "/api/pleroma/admin/users/confirm_email", %{
|
||||
|
|
@ -906,8 +906,11 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
|
||||
assert ret_conn.status == 200
|
||||
|
||||
assert first_user.confirmation_pending == true
|
||||
assert second_user.confirmation_pending == true
|
||||
first_user = User.get_by_id(first_user.id)
|
||||
second_user = User.get_by_id(second_user.id)
|
||||
|
||||
assert first_user.is_confirmed
|
||||
assert second_user.is_confirmed
|
||||
|
||||
log_entry = Repo.one(ModerationLog)
|
||||
|
||||
|
|
@ -920,7 +923,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
|
||||
describe "PATCH /resend_confirmation_email" 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 =
|
||||
patch(conn, "/api/pleroma/admin/users/resend_confirmation_email", %{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ defmodule Pleroma.Web.AdminAPI.StatusControllerTest do
|
|||
assert account["id"] == actor.id
|
||||
assert account["nickname"] == actor.nickname
|
||||
assert account["is_active"] == actor.is_active
|
||||
assert account["confirmation_pending"] == actor.confirmation_pending
|
||||
assert account["is_confirmed"] == actor.is_confirmed
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
describe "GET /api/pleroma/admin/users" do
|
||||
test "renders users array for the first page", %{conn: conn, admin: admin} do
|
||||
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")
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
user2,
|
||||
%{
|
||||
"local" => true,
|
||||
"approval_pending" => true,
|
||||
"is_approved" => false,
|
||||
"registration_reason" => "I'm a chill dude",
|
||||
"actor_type" => "Person"
|
||||
}
|
||||
|
|
@ -635,11 +635,11 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
end
|
||||
|
||||
test "only unconfirmed users", %{conn: conn} do
|
||||
sad_user = insert(:user, nickname: "sadboy", confirmation_pending: true)
|
||||
old_user = insert(:user, nickname: "oldboy", confirmation_pending: true)
|
||||
sad_user = insert(:user, nickname: "sadboy", is_confirmed: false)
|
||||
old_user = insert(:user, nickname: "oldboy", is_confirmed: false)
|
||||
|
||||
insert(:user, nickname: "happyboy", approval_pending: false)
|
||||
insert(:user, confirmation_pending: false)
|
||||
insert(:user, nickname: "happyboy", is_approved: true)
|
||||
insert(:user, is_confirmed: true)
|
||||
|
||||
result =
|
||||
conn
|
||||
|
|
@ -649,8 +649,8 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
users =
|
||||
Enum.map([old_user, sad_user], fn user ->
|
||||
user_response(user, %{
|
||||
"confirmation_pending" => true,
|
||||
"approval_pending" => false
|
||||
"is_confirmed" => false,
|
||||
"is_approved" => true
|
||||
})
|
||||
end)
|
||||
|> Enum.sort_by(& &1["nickname"])
|
||||
|
|
@ -662,18 +662,18 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
user =
|
||||
insert(:user,
|
||||
nickname: "sadboy",
|
||||
approval_pending: true,
|
||||
is_approved: false,
|
||||
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")
|
||||
|
||||
users = [
|
||||
user_response(
|
||||
user,
|
||||
%{"approval_pending" => true, "registration_reason" => "Plz let me in!"}
|
||||
%{"is_approved" => false, "registration_reason" => "Plz let me in!"}
|
||||
)
|
||||
]
|
||||
|
||||
|
|
@ -816,8 +816,8 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
end
|
||||
|
||||
test "`active` filters out users pending approval", %{token: token} do
|
||||
insert(:user, approval_pending: true)
|
||||
%{id: user_id} = insert(:user, approval_pending: false)
|
||||
insert(:user, is_approved: false)
|
||||
%{id: user_id} = insert(:user, is_approved: true)
|
||||
%{id: admin_id} = token.user
|
||||
|
||||
conn =
|
||||
|
|
@ -913,8 +913,8 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
end
|
||||
|
||||
test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do
|
||||
user_one = insert(:user, approval_pending: true)
|
||||
user_two = insert(:user, approval_pending: true)
|
||||
user_one = insert(:user, is_approved: false)
|
||||
user_two = insert(:user, is_approved: false)
|
||||
|
||||
conn =
|
||||
patch(
|
||||
|
|
@ -924,7 +924,7 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
)
|
||||
|
||||
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)
|
||||
|
||||
|
|
@ -960,8 +960,8 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false,
|
||||
"approval_pending" => false,
|
||||
"is_confirmed" => true,
|
||||
"is_approved" => true,
|
||||
"url" => user.ap_id,
|
||||
"registration_reason" => nil,
|
||||
"actor_type" => "Person"
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
|
|||
end
|
||||
|
||||
test "it returns unapproved user" do
|
||||
unapproved = insert(:user, approval_pending: true)
|
||||
unapproved = insert(:user, is_approved: false)
|
||||
insert(:user)
|
||||
insert(:user)
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
|
|||
end
|
||||
|
||||
test "it returns unconfirmed user" do
|
||||
unconfirmed = insert(:user, confirmation_pending: true)
|
||||
unconfirmed = insert(:user, is_confirmed: false)
|
||||
insert(:user)
|
||||
insert(:user)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue