fixed Newsletter Page displaying distribution for deleted articles

This commit is contained in:
Mia Rose Winter 2024-03-14 14:23:29 +01:00
parent 8d0a21c833
commit 791a11d053
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
2 changed files with 1 additions and 1 deletions

View file

@ -67,7 +67,6 @@
await using var context = await ContextFactory.CreateDbContextAsync(); await using var context = await ContextFactory.CreateDbContextAsync();
Newsletters = await context.Set<EmailNewsletter>() Newsletters = await context.Set<EmailNewsletter>()
.IgnoreQueryFilters().IgnoreAutoIncludes()
.Include(n => n.Article) .Include(n => n.Article)
.OrderByDescending(n => n.DistributionDateTime) .OrderByDescending(n => n.DistributionDateTime)
.ToListAsync(); .ToListAsync();

View file

@ -95,6 +95,7 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
newsletter.Property(a => a.DistributionDateTime) newsletter.Property(a => a.DistributionDateTime)
.HasConversion(dateTimeOffsetUtcConverter); .HasConversion(dateTimeOffsetUtcConverter);
newsletter.HasQueryFilter(n => !n.Article.IsDeleted);
newsletter.ToTable("Newsletter"); newsletter.ToTable("Newsletter");
}); });
builder.Entity<EmailSubscriber>(subscriber => { builder.Entity<EmailSubscriber>(subscriber => {