- Any thread with a lastpost.time BEFORE current user's thread_view_cutoff is considered read.
- Otherwise, any thread NOT in the thread_views table at all is considered unread.
- Otherwise, any thread in the thread_views table is considered read IFF last_viewed > lastpost.time
READ: lastpost.time <= user.thread_view_cutoff OR (thread_views.last_viewed IS NOT NULL AND thread_views.last_viewed > lastpost.time)
NOT: lastpost.time > user.thread_view_cutoff AND (thread_views.last_viewed IS NULL OR thread_views.last_viewed < lastpost.time)
WHEN RETRIEVING FORUMS:
- holy fuck I don't know! do all that but for every thread? augh! find an optimization!
WHEN RETRIEVING THREADS:
- each one is subject to the above sql
WHEN RETRIEVING POSTS:
- if lastpost.time is before the cutoff, this is a hella old thread and whatever
- if there is no thread_views entry, everything is unread; create a row and update it as usual
- draw a big line between the posts that correspond to last_viewed, or at the top/bottom if it is before/after the current page, or who knows! be clever. link it to the post if it's not at that boundary
- also update the last_viewed time to be that of the last post on the page
