Merge branch 'feature/order-users-by-nickname-admin-api' into 'develop'

Order users by nickname

See merge request pleroma/pleroma!945
This commit is contained in:
kaniini 2019-03-18 23:08:31 +00:00
commit 43bd7f47db
3 changed files with 10 additions and 11 deletions

View File

@ -773,7 +773,7 @@ def get_recipients_from_activity(%Activity{recipients: to}) do
}) :: {:ok, [Pleroma.User.t()], number()} }) :: {:ok, [Pleroma.User.t()], number()}
def search_for_admin(%{query: nil, local: local, page: page, page_size: page_size}) do def search_for_admin(%{query: nil, local: local, page: page, page_size: page_size}) do
query = query =
from(u in User, order_by: u.id) from(u in User, order_by: u.nickname)
|> maybe_local_user_query(local) |> maybe_local_user_query(local)
paginated_query = paginated_query =

View File

@ -150,8 +150,7 @@ test "escapes invalid characters in url" do
{:ok, data} = Upload.store(file) {:ok, data} = Upload.store(file)
[attachment_url | _] = data["url"] [attachment_url | _] = data["url"]
assert Path.basename(attachment_url["href"]) == assert Path.basename(attachment_url["href"]) == "an%E2%80%A6%20image.jpg"
"an%E2%80%A6%20image.jpg"
end end
test "escapes reserved uri characters" do test "escapes reserved uri characters" do

View File

@ -494,14 +494,6 @@ test "only local users with no query" do
"count" => 2, "count" => 2,
"page_size" => 50, "page_size" => 50,
"users" => [ "users" => [
%{
"deactivated" => admin.info.deactivated,
"id" => admin.id,
"nickname" => admin.nickname,
"roles" => %{"admin" => true, "moderator" => false},
"local" => true,
"tags" => []
},
%{ %{
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
@ -509,6 +501,14 @@ test "only local users with no query" do
"roles" => %{"admin" => false, "moderator" => false}, "roles" => %{"admin" => false, "moderator" => false},
"local" => true, "local" => true,
"tags" => [] "tags" => []
},
%{
"deactivated" => admin.info.deactivated,
"id" => admin.id,
"nickname" => admin.nickname,
"roles" => %{"admin" => true, "moderator" => false},
"local" => true,
"tags" => []
} }
] ]
} }