From 791a11d0533a68e519c9c1d5f7338ec24396aa5d Mon Sep 17 00:00:00 2001 From: Mia Winter Date: Thu, 14 Mar 2024 14:23:29 +0100 Subject: [PATCH] fixed Newsletter Page displaying distribution for deleted articles --- Wave/Components/Pages/Newsletter.razor | 1 - Wave/Data/ApplicationDbContext.cs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Wave/Components/Pages/Newsletter.razor b/Wave/Components/Pages/Newsletter.razor index bb6c79d..bf3d618 100644 --- a/Wave/Components/Pages/Newsletter.razor +++ b/Wave/Components/Pages/Newsletter.razor @@ -67,7 +67,6 @@ await using var context = await ContextFactory.CreateDbContextAsync(); Newsletters = await context.Set() - .IgnoreQueryFilters().IgnoreAutoIncludes() .Include(n => n.Article) .OrderByDescending(n => n.DistributionDateTime) .ToListAsync(); diff --git a/Wave/Data/ApplicationDbContext.cs b/Wave/Data/ApplicationDbContext.cs index ac76582..be680f5 100644 --- a/Wave/Data/ApplicationDbContext.cs +++ b/Wave/Data/ApplicationDbContext.cs @@ -95,6 +95,7 @@ public class ApplicationDbContext(DbContextOptions options newsletter.Property(a => a.DistributionDateTime) .HasConversion(dateTimeOffsetUtcConverter); + newsletter.HasQueryFilter(n => !n.Article.IsDeleted); newsletter.ToTable("Newsletter"); }); builder.Entity(subscriber => {