Skip to content

Commit

Permalink
fix activity posts not marked as read (#2008)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Masterjun3 authored Oct 14, 2024
1 parent 2762bc6 commit a094d91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TASVideos.Core/Services/ForumService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public async Task<int> 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)
Expand Down Expand Up @@ -306,7 +306,7 @@ public async Task<int> 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)
Expand Down

0 comments on commit a094d91

Please sign in to comment.