fix: you can now delete posts from the report page

This commit is contained in:
limited_dev 2023-02-12 14:02:01 +01:00
parent cb7ca62590
commit b1a6ab211e

View file

@ -26,6 +26,8 @@ public static class CommentsRepository
.Where(comment => comment.CommentID == postId)
.Include(comment => comment.Image)
.Include(comment => comment.Post)
.Include(comment => comment.User)
.Include(comment => comment.Report)
.FirstOrDefaultAsync();
}
@ -63,6 +65,8 @@ public static class CommentsRepository
{
await using var db = new AppDBContext();
CommentData commentToDelete = await getCommentByIdAsync(postId);
if (commentToDelete.Report != null)
db.Remove(commentToDelete.Report);
db.Remove(commentToDelete);
return await db.SaveChangesAsync() >= 1;
}