[backend/masto-client] Fix search pagination using offset parameter
All checks were successful
/ unit-tests (push) Successful in 23s
/ build-and-push (push) Successful in 1m54s

This commit is contained in:
Laura Hausmann 2024-05-16 00:26:39 +02:00
parent 2c7490a304
commit 961bda0164
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -133,9 +133,9 @@ public class SearchController(
.Where(p => p.DisplayNameOrUsernameOrFqnContainsCaseInsensitive(search.Query!,
config.Value.AccountDomain))
.Where(p => !search.Following || p.IsFollowedBy(user))
.Skip(pagination.Offset ?? 0)
.Paginate(pagination, ControllerContext) //TODO: this will mess up our sorting
.OrderByDescending(p => p.NotesCount)
.Skip(pagination.Offset ?? 0)
.RenderAllForMastodonAsync(userRenderer);
}
@ -185,8 +185,8 @@ public class SearchController(
.FilterByUser(search.UserId)
.EnsureVisibleFor(user)
.FilterHidden(user, db)
.Paginate(pagination, ControllerContext)
.Skip(pagination.Offset ?? 0)
.Paginate(pagination, ControllerContext)
.PrecomputeVisibilities(user)
.RenderAllForMastodonAsync(noteRenderer, user);
}
@ -200,9 +200,9 @@ public class SearchController(
{
return await db.Hashtags
.Where(p => EF.Functions.ILike(p.Name, "%" + EfHelpers.EscapeLikeQuery(search.Query!) + "%"))
.Skip(pagination.Offset ?? 0)
.Paginate(pagination, ControllerContext)
.OrderByDescending(p => p.Id)
.Skip(pagination.Offset ?? 0)
.Select(p => new TagEntity
{
Name = p.Name,