keith-b-git / ct

Club Triumph
GNU General Public License v3.0
1 stars 0 forks source link

[Forum] ‘Read’ (past tense) threads aren’t marked as read (unbolded) #11

Open meredevelopment opened 5 years ago

meredevelopment commented 5 years ago

The Bug

As reported by others, and confirmed by me: After reading a thread, it likely won’t be marked as read when viewing the the thread listing again. Occasionally visiting another thread then returning seems to mark the original one as read. Only way to guarantee it works is to disable browser cache.

Expected Behaviour

Viewing the last (or only) post of a thread should mark it as read.

Notes

What’s the mechanism that registers a ‘read’? Is it based on the next page load? If so might it be possible to register the read with an Ajax call?

keith-b-git commented 5 years ago

It should mark it as read when the post is viewed, but the problem as you say is browser cache. It needs to be resolved client side somehow. It's pretty dumb at the moment and doesn't use ajax, just presents the data in a table so definitely could be engineered better, open to suggestions!

meredevelopment commented 5 years ago

Ok from a quick search around, most OS forum software seems to use an Ajax call to mark the thread read when the last post in that thread has been displayed. Some do it after a delay of 10 seconds or something.

Some keep a pivot table of users to posts, some seem to keep a file cache of read-timestamps against thread last-post-timestamps. One reference was suggesting keeping records of 'unreads' and not 'reads' because reads will grow and grow but unreads only grows with membership and shrinks as the membership gets more active.... something like that. There are probably about 100 different was to do this!

I guess the exact implementation depends on what's already in place and building on that. Can you share an overview of how it currently works. Also whether there's any sort of API/Endpoint to send an Ajax POST/PATCH to or whether that'll need adding.

keith-b-git commented 5 years ago

Currently there's a table of read items which contains links to user and item and includes a post count. Agree there's loads of ways to do it. Currently a 'mark all posts read' function could take a long time, but then again the user may expect that if there are 100,000+! Perhaps there could be another table that it looks at first with a cut off date in it, and then look at the detailed recent read posts table. That would keep the data down but gets a lot more complicated. There a lot of dormant users, so an unread table would require a lot to happen after a posting.