From cb2bdd5c071e5823e408bedeb3b9183893ad8cd1 Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Sun, 17 Mar 2019 13:23:08 +0300 Subject: [PATCH 1/3] Order users by nickname --- lib/pleroma/user.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 692ae836c..6de766fc1 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -773,7 +773,7 @@ def get_recipients_from_activity(%Activity{recipients: to}) do }) :: {:ok, [Pleroma.User.t()], number()} def search_for_admin(%{query: nil, local: local, page: page, page_size: page_size}) do query = - from(u in User, order_by: u.id) + from(u in User, order_by: u.nickname) |> maybe_local_user_query(local) paginated_query = From 93291c3d7a4dc580a2c76653521b7f6653cf4113 Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Sun, 17 Mar 2019 13:23:08 +0300 Subject: [PATCH 2/3] Order users by nickname --- lib/pleroma/user.ex | 2 +- test/upload_test.exs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 692ae836c..6de766fc1 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -773,7 +773,7 @@ def get_recipients_from_activity(%Activity{recipients: to}) do }) :: {:ok, [Pleroma.User.t()], number()} def search_for_admin(%{query: nil, local: local, page: page, page_size: page_size}) do query = - from(u in User, order_by: u.id) + from(u in User, order_by: u.nickname) |> maybe_local_user_query(local) paginated_query = diff --git a/test/upload_test.exs b/test/upload_test.exs index 770226478..bdda01b3f 100644 --- a/test/upload_test.exs +++ b/test/upload_test.exs @@ -150,8 +150,7 @@ test "escapes invalid characters in url" do {:ok, data} = Upload.store(file) [attachment_url | _] = data["url"] - assert Path.basename(attachment_url["href"]) == - "an%E2%80%A6%20image.jpg" + assert Path.basename(attachment_url["href"]) == "an%E2%80%A6%20image.jpg" end test "escapes reserved uri characters" do From 76a13bc5a203970c36cace0791b4855c5613b91e Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Sun, 17 Mar 2019 13:29:28 +0300 Subject: [PATCH 3/3] Fix test --- test/web/admin_api/admin_api_controller_test.exs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs index e50f0edde..0aab7f262 100644 --- a/test/web/admin_api/admin_api_controller_test.exs +++ b/test/web/admin_api/admin_api_controller_test.exs @@ -494,14 +494,6 @@ test "only local users with no query" do "count" => 2, "page_size" => 50, "users" => [ - %{ - "deactivated" => admin.info.deactivated, - "id" => admin.id, - "nickname" => admin.nickname, - "roles" => %{"admin" => true, "moderator" => false}, - "local" => true, - "tags" => [] - }, %{ "deactivated" => user.info.deactivated, "id" => user.id, @@ -509,6 +501,14 @@ test "only local users with no query" do "roles" => %{"admin" => false, "moderator" => false}, "local" => true, "tags" => [] + }, + %{ + "deactivated" => admin.info.deactivated, + "id" => admin.id, + "nickname" => admin.nickname, + "roles" => %{"admin" => true, "moderator" => false}, + "local" => true, + "tags" => [] } ] }