From a094d913d898bb557a708c1187667459dc4ba4aa Mon Sep 17 00:00:00 2001 From: Masterjun Date: Mon, 14 Oct 2024 15:51:00 +0200 Subject: [PATCH] fix activity posts not marked as read (#2008) we cache posts for 1 day, so we have to account for that by making sure that in 1 day none of the posts we have cached exceed the active-days constant. otherwise they don't get marked as read. --- TASVideos.Core/Services/ForumService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TASVideos.Core/Services/ForumService.cs b/TASVideos.Core/Services/ForumService.cs index 17921de5e..8181910bb 100644 --- a/TASVideos.Core/Services/ForumService.cs +++ b/TASVideos.Core/Services/ForumService.cs @@ -254,7 +254,7 @@ public async Task CreatePost(PostCreate post) return forumActivity; } - DateTime minimumDate = DateTime.UtcNow.AddDays(-ForumConstants.DaysPostsCountAsActive); + DateTime minimumDate = DateTime.UtcNow.AddDays(-(ForumConstants.DaysPostsCountAsActive - 1)); // we subtract 1 day here because we cache activity for 1 day var fullrow = await db.ForumPosts .Where(fp => fp.CreateTimestamp > minimumDate || fp.PostEditedTimestamp > minimumDate) @@ -306,7 +306,7 @@ public async Task CreatePost(PostCreate post) return subforumActivity; } - DateTime minimumDate = DateTime.UtcNow.AddDays(-ForumConstants.DaysPostsCountAsActive); + DateTime minimumDate = DateTime.UtcNow.AddDays(-(ForumConstants.DaysPostsCountAsActive - 1)); // we subtract 1 day here because we cache activity for 1 day var fullrow = await db.ForumPosts .Where(fp => fp.CreateTimestamp > minimumDate || fp.PostEditedTimestamp > minimumDate)