can we start reading from the new comments? February 15, 2001 4:52 PM   Subscribe

Is it possible in the customization to enter each thread where the new comments begin? I have mentioned before that I'm not a programmer, so that's my excuse if this is a stupid question.
posted by norm to Feature Requests at 4:52 PM (24 comments total)

There's been discussion about indicators in threads where new comments begin, usually something like a horizontal rule is suggested.

preceding new comments would be snazzy.

I imagine it's pretty tricky to implement. If it were a quick fix, Matt would've snuck it in during his time off. From a programmatic perspective, it would be kind of difficult to figure out where a new comment is.

The way I figure the implementation works - and this is just as a user, I haven't seen an code - is almost every time you hit a MetaFilter page, your "last visited" information (both in the cookie and the database, I believe, but definitely in the cookie) are updated to the current time. Since obviously the messages you're seeing in a thread are older then the current time, putting a line in would be tricky.

What may be doable - again, off the top of my head - is passing in the number of new posts in the query string. Matt's got those weird non-query string things though, so I don't know how workable that is. But if he figures out the number of posts on a page (the count of records being returned from the db) and subtracts the number of new posts, then putting in an indicator is relatively easy.

Putting in an anchor may be tricky, because you can't know what the post id of the first new comment is until you actually get to the outputtin' of the comment, not without some fancy (read: time and processor wasting) footwork before displaying the page.

Well, putting in the anchor's easy, but automagically starting the page off at the anchor's a pain, though definitely doable given some time.

(what may work though is a link at the top of the page to "New Posts" that jumps to a pre-determined anchor name, like newposts or somesuch)

Again, I'm just guessing at the functionality from what I've seen it do and how I'd go about implementing the things I've seen Matt do. Considering how much more knowledgeable Matt is of these things than I am, I could very likely be astoundingly off-base.

Either way, it's a safe bet that it's tricky, otherwise Matt would've done it. :-)
posted by cCranium at 8:24 AM on February 16, 2001

yeah, it's a good feature, and something I want to do RealSoonNow.
posted by mathowie (staff) at 2:28 PM on February 16, 2001

ok, thanks to Eric Costello's mad sql skillz, I got this working.

try this page the next time you hit metafilter (you might want to bookmark this for a short while).

If you hit the word "new" it will open a new window, and jump down to the first of new comments posted since your last visit.

The way it works is temporary, which is why I want people to test it out. The link is essentially hidden, so there's a UI problem to solve, and the opens in a new window thing might bug people, even though I think it's the best way to maintain visit state, given the shitty session implementation I'm still currently using and not rewriting just yet. So give it a go and comment here.

posted by mathowie (staff) at 5:14 PM on February 16, 2001

Probably happening to others, but I get:

"posted by Succa at 11:10 AM PST on Feb 16 - 7 comments (7 site administrator that this error has occurred (be sure to include the contents of this page in your message to the administrator)."
posted by gluechunk at 5:33 PM on February 16, 2001

crap. ok, fixing.
posted by mathowie (staff) at 5:38 PM on February 16, 2001

is it fixed now?
posted by mathowie (staff) at 5:40 PM on February 16, 2001

yup, no more error message. seems to work fine.
posted by gluechunk at 6:13 PM on February 16, 2001

Thanks Matt that is a great a feature. It works well for me. (IE 5.5 SP1, Win 98 SE.)
posted by riffola at 7:31 PM on February 16, 2001

Wow. I'm really impressed. Thanks, Matt!
posted by norm at 7:54 PM on February 16, 2001

Ok, no bugs found, so I made it the index page.
posted by mathowie (staff) at 11:29 PM on February 16, 2001

Yes! It works! Props to Eric and Matt! Wow, this will make MetaFilter SO much easier to waste time with!
posted by kindall at 12:08 AM on February 17, 2001

I have my MeFi prefs set to open links in the same window, but these new links pop open a new window. Is that intentional?
posted by ericost at 12:14 AM on February 17, 2001

yep intentional eric, otherwise people would say "i followed one link, and when I went back, the new indicators were lost" which I mentioned above is why I'd have to redo the session stuff to fix.
posted by mathowie (staff) at 12:48 AM on February 17, 2001

Matt, I think there is a way to make links open in the same window, and yet keep the "new" indicators on.

At the bottom of the thread that the user reads (and preferrably above the 'comments' field), you could have a link to the Metafilter main page set up like this: javascript:history.go(-1); (example Back to MeFi).

This way, when the user clicks on the "Back to MeFi" link, he/she is served the original page that he/she first saw (with the "new" indicators, of course).

I think that this is quite easy to implement and will probably save you from rewriting the "sessions" code.

Of course, if the user visits the thread via an outside link (and not via the main MeFi page), the "Back to MeFi" link I proposed will get him back to the site from which he first came. For this case, I guess that you could write some javascript (?) code that would check if the user comes from the MeFi main page or not. - If he comes from the MeFi main page, then set up the "Back to MeFi" link as I proposed above. - If he doesn't come from the MeFi main page, set the "Back to MeFi" link as an absolute link to "".

Either way, the user will get to the main MeFi page with the "new" indicators on.

I wish I knew javascript to help you write that code, but I don't - I believe though, that it's probably an easy thing to do (=write the code, that is).

Anyway, I hope this helped a bit.

God, I hope that the sentences above made some sense. It's a tough thing on the Web, when English is not your native language...
posted by kchristidis at 5:49 AM on February 17, 2001

Matt, Eric, this is done perfectly. Thank you.

kchristidis: Using the "back" button in the browser doesn't preserve the "new" indicators, so using the history through JavaScript wouldn't, unfortunately, work.
posted by cCranium at 6:24 AM on February 17, 2001

Matt, this is great. I don't like it opening in a new window much either, but I understand the point about keeping state. I'm sure pretty soon it will seem totally natural. I think the UI is pretty good too--minimal, in keeping with the rest of MF's UI, but surprisingly clear. I knew what it was before I clicked.

cC and kchristidis, I would think it would depend on whther the borwser reloads from the cache or the network, but either way it isn't something you can depend on for state management.
posted by rodii at 8:21 AM on February 17, 2001

cCranium: Hmm...this is weird because the browser preserves the "new" indicators in my case.

Anyway, it was just an idea for a (temporary) solution.
posted by kchristidis at 8:54 AM on February 17, 2001

Me too kchristidis. On all my browsers and platforms the back button works fine, just jumping me back to the previous page without a reload. cCranium, can you test again, and if you do indeed get a refreshed home page when you use your back button, can you tell us what your configuration is?

I for one would still like to be able to set a preference or something to keep the links from launching a new window. I can use my back button just fine to preserve all the new comment indicators, and I already keep too many windows open on my little ole laptop.

But this is a minor request. Great new feature Matt.
posted by ericost at 9:35 AM on February 17, 2001

matt, that is fantastic. thanks!
posted by palegirl at 10:26 AM on February 17, 2001

I actually think this almost replaces the "recent comments" feature for me—in "date" sort mode I can just scroll down the page scanning for the (n new ยป) elements. It's quick 'n' easy, and I don't have to switch sort modes (which does cause me to lose state when I do it). Very, very nice!
posted by rodii at 12:21 PM on February 17, 2001

eric, it's a seemingly random occurance, and I don't think it's easily duplicatable, unfortunately.

I remember talking about this previously, which is when someone suggested that I just open the comments pages in a new window, which works wonderfully.

The only thing I can say for certain is that some days, especially when there's over 100 new comments that I'm reading, when I hit back it refreshes my last-visited info.

Oh, and I'm using IE5.something on Win98.

I've left the window open for a good 10 minutes and it hasn't happened, so maybe I'm just hallucinating. I'll let you guys know if it happens to me again, but I doubt it will since I'll be using the new link in a new window all the time now.

I do agree it should be user-configurable, but that's mostly because I think pretty much everything should be. :-)
posted by cCranium at 9:42 AM on February 18, 2001

aha! I just duplicated it.

If I have a comments thread open, and create a new window (ctrl-n in IE) then hit back in the original, the main page refreshes and my "new" info is lost.

I suspect refreshing the comments window will do the same thing, but there aren't any new comments right now for me to try that on, I'll give 'er a go next time I visit.

I know, it's a pretty hairy way to create a bug, and probably quite rare. You can likely put it way down near the bottom of your list, it's pretty minor.
posted by cCranium at 9:45 AM on February 18, 2001

cCranium: since I posted I have seen it happen too, sporadically, and when I only have one browser window open. I can offer no explanation.
posted by ericost at 9:35 PM on February 18, 2001

Yeah, it's a weird one, I agree. Opening everything in new windows resolves it though, because you never have to refresh that main page.
posted by cCranium at 9:48 AM on February 19, 2001

« Older January 2001 stats   |   This is another request regarding the way threads... Newer »

You are not logged in, either login or create an account to post comments