Right now, when landing on the homepage, a user has no easy way to know if new comments have been posted on a story, whose comments they’ve already read.
Similarly to how new comments are highlighted in a story’s page, but for the homepage.
My personal workaround is to try to remember more or less how many comments were there last time I checked, and click through in case I think there are new ones. But considering lobste.rs already knows about “new comments” for each user, it seems like this wouldn’t be too hard to implement.
I’d like something a bit more opt in. I get a message if someone posts a reply to a comment I’ve made, but I don’t get one if someone pasts a comment on a story I’m interested in or deeper in a thread. I’d quite like a way to flag a story or thread so I got a notification if there were any new comments below it.
You could flag a story or thread for these notifications by upvoting it.
I worry this would increase DB load too much, but it would be cool if it’s feasible.
There may be a way to implement this with hardly any additional server load at all.
Make the timestamp of the most recent comment available in the HTML, maybe as a data- attribute. The number of comments is available already, so put that in another data- attribute.
Then add JavaScript that stores those values in localStorage any time you view a thread.
On the homepage, JavaScript can run that checks to see which posts have updated last-comment and num-comment values since your last visit to the thread, and highlights those posts (“3 new comments”)
The localstorage values could be automatically cleared when for stories that haven’t had an update in more than 48 hours.
I read lobsters from different devices and it would be a bit weird if one set of unread notifications was global and another was per-device.
If you are logged in on all devices, this actually doesn’t need javascript at all, just a custom stylesheet that is per user and styles according to that value. Obviously, it can’t be cached though.
(I’ve built such systems, it works nicely)
However, lobste.rs has relatively little churn, so I’m not sure how much that is a problem and merits the complexity? I usually have the last comment number in my head roughly or i don’t care about the discussion.
Yeah that’s a great point.
The alternative requires a database write every time a user views a thread, which might be too much overhead?
Isn’t the comments that you’ve read tricked anyway? If you revisit a page, new comments are already marked, so I presume the information to do this is there already, it just needs exposing in a different bit of the UI.
I dug into the code.
https://github.com/lobsters/lobsters/blob/3802a3503dd3ede1b996effbe952ace42ff5f8ac/app/controllers/stories_controller.rb#L13
In stories controller:
https://github.com/lobsters/lobsters/blob/3802a3503dd3ede1b996effbe952ace42ff5f8ac/app/controllers/stories_controller.rb#L498-L503
https://github.com/lobsters/lobsters/blob/3802a3503dd3ede1b996effbe952ace42ff5f8ac/app/models/read_ribbon.rb#L35-L41
So yeah, any visit by a logged in user to a story page bumps a timestamp on a record already.
Given that this information is already being stored, I think the overhead required to show which stories have had new comments since you last viewed them when you are viewing the site homepage would boil down to a SQL query something like this:
(I’m guessing some aspects of the schema here.)
With the right indexes in place (likely already there) I expect this would be a fast enough query to be acceptable.
One catch: I don’t think there’s a denormalized last_comment_created_at column - it looks like the current denormalization on the stories table only covers a count of comments, not when the most recent one was saved: https://github.com/lobsters/lobsters/blob/3802a3503dd3ede1b996effbe952ace42ff5f8ac/app/models/story.rb#L818C1-L823
Yeah, it’s no more writes, but it adds an extra dB read to every view of a list of stories.
I keep a tab open as long as I’m interested/motivated by the discussion, and I hit refresh sometimes in-between tasks. If I close the tab, it means I’m not interested in the discussion anymore.
I like that HN and lobste.rs don’t try to become yet another social network full of distracting notifications.
Do you close the tabs when you lose interest or when there have been no new comments for a while? I just went back to a story from a few weeks ago and saw that there were two comments posted after I stopped polling. I’d like to have had a message when they were posted.
When I lose interest. But I also lose interest when there have been no new comments for a while :)
Also, I’m the kind of person with multiple Chrome windows opened on multiple virtual desktops, with dozens of tabs in each, all grouped per activity (the virtual desktop) and category (the Chrome tab group). So I sometimes have tabs open for a few months.
This would be great to have! Like others suggested, I was also keeping tabs open or remembering how many comments were there when I last visited. But that scales badly with age.
If this would put too much stress on the db. What about explicitly “following” a story and only tracking changes to its comments?
In my opinion, the current comment volume is small enough that it’s feasible to read (or at least scan) a day’s worth by reading the first 2 pages of the
/comments
page.