Add more tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
0f90fd5805
commit
eedf551eed
7 changed files with 100 additions and 21 deletions
|
|
@ -1525,9 +1525,9 @@ defmodule Pleroma.User do
|
|||
with max_endorsed_users <- Pleroma.Config.get([:instance, :max_endorsed_users], 0),
|
||||
endorsed_users <-
|
||||
User.endorsed_users_relation(endorser)
|
||||
|> Pleroma.Repo.all() do
|
||||
|> Repo.aggregate(:count, :id) do
|
||||
cond do
|
||||
Enum.count(endorsed_users) >= max_endorsed_users ->
|
||||
endorsed_users >= max_endorsed_users ->
|
||||
{:error, "You have already pinned the maximum number of users"}
|
||||
|
||||
not following?(endorser, target) ->
|
||||
|
|
|
|||
|
|
@ -529,10 +529,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
|
|||
users =
|
||||
user
|
||||
|> User.endorsed_users_relation(_restrict_deactivated = true)
|
||||
|> Pleroma.Pagination.fetch_paginated(Map.put(params, :skip_order, true))
|
||||
|> Pleroma.Repo.all()
|
||||
|
||||
conn
|
||||
|> add_link_headers(users)
|
||||
|> render("index.json",
|
||||
users: users,
|
||||
for: user,
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ defmodule Pleroma.Web.PleromaAPI.AccountController do
|
|||
|> Pleroma.Repo.all()
|
||||
|
||||
conn
|
||||
|> add_link_headers(users)
|
||||
|> render("index.json",
|
||||
for: for_user,
|
||||
users: users,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue