From e548758608c1a5daae076919e49d33b2c1c87715 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 26 Apr 2024 17:30:42 +0100 Subject: [PATCH] fix: don't show redirected posts --- OliverBooth/Services/BlogPostService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OliverBooth/Services/BlogPostService.cs b/OliverBooth/Services/BlogPostService.cs index 8bdda24..9fcd8cf 100644 --- a/OliverBooth/Services/BlogPostService.cs +++ b/OliverBooth/Services/BlogPostService.cs @@ -45,7 +45,7 @@ internal sealed class BlogPostService : IBlogPostService { using BlogContext context = _dbContextFactory.CreateDbContext(); IQueryable ordered = context.BlogPosts - .Where(p => p.Visibility == Visibility.Published) + .Where(p => p.Visibility == Visibility.Published && !p.IsRedirect) .OrderByDescending(post => post.Published); if (limit > -1) { @@ -60,7 +60,7 @@ internal sealed class BlogPostService : IBlogPostService { using BlogContext context = _dbContextFactory.CreateDbContext(); return context.BlogPosts - .Where(p => p.Visibility == Visibility.Published) + .Where(p => p.Visibility == Visibility.Published && !p.IsRedirect) .OrderByDescending(post => post.Published) .Skip(page * pageSize) .Take(pageSize) @@ -72,7 +72,7 @@ internal sealed class BlogPostService : IBlogPostService { using BlogContext context = _dbContextFactory.CreateDbContext(); return context.BlogPosts - .Where(p => p.Visibility == Visibility.Published) + .Where(p => p.Visibility == Visibility.Published && !p.IsRedirect) .OrderBy(post => post.Published) .FirstOrDefault(post => post.Published > blogPost.Published); } @@ -82,7 +82,7 @@ internal sealed class BlogPostService : IBlogPostService { using BlogContext context = _dbContextFactory.CreateDbContext(); return context.BlogPosts - .Where(p => p.Visibility == Visibility.Published) + .Where(p => p.Visibility == Visibility.Published && !p.IsRedirect) .OrderByDescending(post => post.Published) .FirstOrDefault(post => post.Published < blogPost.Published); }