CS Bug: Read Status
Recently, someone posted that Community Server has had a bug surrounding the "read status" of threads and forums. With yesterday's update to communityserver.org, we are finally closer to closing out the issue. So why is this a "hard" problem? It's not, but we wanted to do it right, and that took some time to investigate...and still requires a bit of feedback.
Although both threads and forums track read status, the difficulty only really occurs at the forum level because it's an "aggregate read status". If a user reads a thread, we can just mark it as read and can easily display it's status. But determining if a forum is "read" is a little less trivial. I see three scenarios that we need to verify:
-
A user explicitly clicks the "Mark all read" button within the More Options on a thread list page
-
A user explicitly reads every single thread within a forum
-
A user marks all as read at one time and then reads all new/updated threads after
The easiest solution would be to just add a row (to cs_ThreadsRead) for every thread in a forum when a user clicks "Mark all read" within a forum. BUT, what if we're at http://forums.xbox.com or http://forums.asp.net. Since many of those forums have upwards of 1,000 threads (some have > 20,000 threads) with just 1,000 users we're well beyond a million records. It's a situation that would quickly get out of hand. Especially since the user performed a simple action (click a button) that resulted in significant data creation (> 1,000 rows added to db). Nope, that won't work!
So instead we've come up with another solution. When the user marks all as read, we can store the most recent post id signifying all posts previous have been read. Now the trick is to do our checks at the right time and make sure our read status "bubbles up". While there has been code in the past scattered throughout, we opted to centralize it with the fix. Now, whenever a thread is marked as read, the forum is checked to see if there exist any threads that have posts more recent than the last time the user clicked "Mark all read" which have not been individually read.
We're still looking at a couple other minor scenarios to make sure we've completely nailed it, but the main code path looks to be solid. Let me know if you experience further problems...
BTW: I think this is the first time I "future post" to my blog...I'm out for the weekend but still blogging...woot! 