Compare commits

...

2 Commits

Author SHA1 Message Date
cf4d92c035
fix: oops, page 2 was completely missing.
The model contains a 1-based page number, whereas GetBlogPosts wants 0-based index, causing an entire page to be missing.
2024-05-06 17:40:03 +01:00
58797b82ca
fix: don't include redirected posts in count 2024-05-06 17:39:28 +01:00
2 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@
@await Html.PartialAsync("Partials/_MastodonStatus") @await Html.PartialAsync("Partials/_MastodonStatus")
<div id="all-blog-posts"> <div id="all-blog-posts">
@foreach (IBlogPost post in BlogPostService.GetBlogPosts(Model.PageNumber)) @foreach (IBlogPost post in BlogPostService.GetBlogPosts(Model.PageNumber - 1))
{ {
@await Html.PartialAsync("Partials/_BlogCard", post) @await Html.PartialAsync("Partials/_BlogCard", post)
} }

View File

@ -40,8 +40,8 @@ internal sealed class BlogPostService : IBlogPostService
{ {
using BlogContext context = _dbContextFactory.CreateDbContext(); using BlogContext context = _dbContextFactory.CreateDbContext();
return visibility == Visibility.None return visibility == Visibility.None
? context.BlogPosts.Count() ? context.BlogPosts.Count(p => !p.IsRedirect)
: context.BlogPosts.Count(p => p.Visibility == visibility); : context.BlogPosts.Count(p => !p.IsRedirect && p.Visibility == visibility);
} }
/// <inheritdoc /> /// <inheritdoc />