Site Notes

About Bloody Time: RTH Gets Threaded Comments

By Ryan McGreal
Published January 27, 2011

this blog entry has been updated

Back in April, 2008, I optimistically wrote that we would update the commenting system to allow threaded comments "in the near future". (Not surprisingly, I wrote this in response to a nasty troll.)

Today I'm happy to announce that, almost three years later, RTH finally has the threaded comments I've been promising all this time.

The way it works is pretty simple:

Try it out and let me know if you run into any problems.


Update: Some people have reported that they need to refresh their browser a couple of times before the reply buttons and comment thread collapse work properly. This is because browsers often store local copies of frequently-used web page files (like javascript files and stylesheets) so they don't need download those files every time.


Update 2: According to RTH reader seancb, you may need to hold down the shift button while refreshing to force the browser to fetch new copies of the javascript and stylesheet files from the server.


Update 3: I have implemented the ability to switch between nested comment threads and the original flat comments. At the top and the bottom of the comment list are links to View Comments in Nested or Flat format.

The site saves your selection as a cookie so that subsequent pages will be served in your preferred format. This should work for both registered users and for anonymous visitors, as long as you have cookies enabled.


Update 4: I just realized that a child comment of a comment that gets deleted would be orphaned. I've updated the code so that child comments of a comment about to be deleted are attached to the parent comment (or to the OP root if there is no parent comment).


Update 5: I updated the code so that even if you're viewing comments in Flat view, you still get a link to the parent comment of a reply.

Ryan McGreal, the editor of Raise the Hammer, lives in Hamilton with his family and works as a programmer, writer and consultant. Ryan volunteers with Hamilton Light Rail, a citizen group dedicated to bringing light rail transit to Hamilton. Ryan wrote a city affairs column in Hamilton Magazine, and several of his articles have been published in the Hamilton Spectator. His articles have also been published in The Walrus and HuffPost. He maintains a personal website, has been known to share passing thoughts on Twitter and Facebook, and posts the occasional cat photo on Instagram.

44 Comments

View Comments: Nested | Flat

Read Comments

[ - ]

By GrapeApe (registered) | Posted January 27, 2011 at 21:30:11

How do we track replies now? Edit - reply did not work for me. Is this browser specific?

Comment edited by GrapeApe on 2011-01-27 21:31:09

Permalink | Context

By GrapeApe (registered) | Posted January 27, 2011 at 21:32:38 in reply to Comment 58454

Oddly, it works now. Cool

Permalink | Context

[ - ]

By jason (registered) | Posted January 27, 2011 at 21:55:40

nothing happens when I hit 'reply'. I'm on Safari for Mac

Permalink | Context

By jason (registered) | Posted January 27, 2011 at 21:55:57 in reply to Comment 58462

ok, I can reply to my own comment, but not another comment.

Permalink | Context

By grapusapus (anonymous) | Posted January 27, 2011 at 22:07:52 in reply to Comment 58464

works for me

Permalink | Context

By moylek (registered) - website | Posted January 28, 2011 at 08:24:47 in reply to Comment 58470

And for me?

Edit: Yes.

Comment edited by moylek on 2011-01-28 08:25:01

Permalink | Context

[ - ]

By mrgrande (registered) | Posted January 27, 2011 at 21:55:43

Hey Ryan, sorry I wasn't of (any) help with this. I got an implementation working in C# and was trying to port it to Python, but was having troubles getting Python working on my compy.

Looks great! Did you opt to do most of your ordering/arranging in the DB, or is it mostly in the code?

Permalink | Context

[ - ]

By hammy (anonymous) | Posted January 27, 2011 at 22:51:16

Comments with a score below -5 are hidden by default.

You can change or disable this comment score threshold by registering an RTH user account.

Permalink | Context

By mbeacon (anonymous) | Posted January 28, 2011 at 10:25:08 in reply to Comment 58491

And whom can afford to waiste thyme like that?

(Gratuitous comment not intended to feed troll. Just a way to try out new system.)

Permalink | Context

By Undustrial (registered) - website | Posted January 27, 2011 at 23:33:44 in reply to Comment 58491

Didn't work, then I refreshed and it did. Strange. Older Ubuntu with firefox.

What's a "waiste"?

Permalink | Context

By drb (registered) - website | Posted January 27, 2011 at 23:57:36 in reply to Comment 58506

Damn, can get the reply to work. I've tried refresh, and shut down and re-started.

Any way Undustrial, your waiste is the indentation above your hipes. A waiste of time is the narrow part of an hour glasse.

Permalink | Context

[ - ]

By mrjanitor (registered) | Posted January 28, 2011 at 01:09:32

Can't reply. I use Flock as my browser, is that the issue?

Permalink | Context

By rednic (registered) | Posted January 28, 2011 at 07:45:57 in reply to Comment 58509

one of the .1% ! Flock ( on the mac) uses webkit to trender the pages which is the same engine as safari.. so it should work since im posting reply with safari

Permalink | Context

By browser_test (anonymous) | Posted January 28, 2011 at 06:04:24 in reply to Comment 58509

Testing reply with Flock 3.5 on Windows XP.

Permalink | Context

By mrjanitor (registered) | Posted January 28, 2011 at 12:15:22 in reply to Comment 58510

Thanks everybody! Updated from 1.1 to 3.5... yeah, I know! Works great, have to get used to the new features now.

Permalink | Context

[ - ]

By adrian (registered) | Posted January 28, 2011 at 09:15:44

Nice feature!

Suggestion: drop the [ - ], it's distracting and it's not obvious what it's supposed to represent.

Also, there are too many boxes going on. This design needs to be de-boxified!

Permalink | Context

[ - ]

By highwater (registered) | Posted January 28, 2011 at 10:28:03

No! I hate change!

Permalink | Context

[ - ]

By highwater (registered) | Posted January 28, 2011 at 10:28:47

Ok. that was actually a test. clearly reply not working for me either.

Permalink | Context

[ - ]

By mrjanitor (registered) | Posted January 28, 2011 at 12:31:19

OK, this is how I was using RTH, especially when there was a hot topic getting lots of rapid posting. I'd surf other sites for a while, refresh RTH and see if the comment count on the hot topic went up. If comment count went up then I'd scroll to the bottom of the article and read the new content. Now I don't really know where that new content is. It could be anywhere. Imagine one of those 230 comment stories, where are the new comments using the new system? I guess I'm going to have to re-read the whole comment thread to look for anything new. I'm not sure if this is going to be the way to go, I'll give it a fair chance for sure... but I'm a little worried about it.

Permalink | Context

By seancb (registered) - website | Posted January 28, 2011 at 12:52:56 in reply to Comment 58572

I was just thinking the same thing... how do you find the unread comments? Maybe there needs to be a n option to display in non-threaded mode that just lists comments chronologically. or the threads should be listed in order of "most recently received a comment" so the threads with the most recent activity are floated to the top?

Permalink | Context

By Pxtl (registered) - website | Posted January 28, 2011 at 13:32:44 in reply to Comment 58578

This is the problem. Sites that have threaded comments end up with a myriad of tools to manage tracking replies and re-sorting and re-jiggering the commentary.

As a programmer, I can totally see the appeal of wanting a formalized solution to the @suchandsuch convention that most flat commentary systems use, but threaded, imho, creates more problems than it solves unless you're willing to put in the terriffic amount of work it takes to put it all together.

Even old hands at nested commentary like Reddit and Slashdot have a lot of warts in their systems.

Perhaps a flat view that includes a brief header over replies that includes the name and a truncated expandable version of the parent post would work, duct-taping the posts together without the header if the child is chronologically adjascent to the parent... but that would be a fair bit of UI work.

Permalink | Context

By mrjanitor (registered) | Posted January 28, 2011 at 14:26:38 in reply to Comment 58592

Pxtl,

Would a 'mark as read' button that would change the header colour on each comment be a difficult patch to put in. Also, do you think it would really do any good for the usability of the comment section? Just some ideas to make things work.

Permalink | Context

By Pxtl (registered) - website | Posted January 28, 2011 at 14:29:59 in reply to Comment 58616

To clarify, I'm not a contributor here - my previous comment must've suggested that I am. I have no idea what Juju Ryan uses to keep this site running.

I'm just spitballing ideas same as you, from my own knowledge of software development.

But a mark-as-read button would probably be simple to implement, but might be too crude to be useful in a substantial thread, so then you need a mark-all-as-read... and if you forget to use it and come back, and wish to read new commentary, you're still hosed. Either way, like I said - websites with nested commentary need a myriad of tools to make it sensible.

Permalink | Context

By mrjanitor (registered) | Posted January 28, 2011 at 14:43:12 in reply to Comment 58618

Pxtl,

Yes, I know, I was just looking for an experts general opinion. I know Ryan and Adrian work all of the voodoo that make this site such an enriching experience.

If I haven't said this in a while I'll say it now... thank you for creating and opening up this citizen's playground. Hamilton is so much better off due to the amazing efforts put into making RTH work the way it does!

Comment edited by mrjanitor on 2011-01-28 14:43:51

Permalink | Context

[ - ]

By Pxtl (registered) - website | Posted January 28, 2011 at 13:14:52

sigh.

Well, different strokes for different folks. I've always preferred pure-chronological, but that's just me. I spent too much time on Fark in a past life.

Permalink | Context

[ - ]

By bobinnes (registered) - website | Posted January 28, 2011 at 20:03:46

kudos Ryan. PDC - pretty darn cool. Having a new appreciation for the coding involved, i'm curious as to the development/ history - any dimension you care to share. Way too ambitious for me!!! Cheers. Bob.

Permalink | Context

[ - ]

By mrjanitor (registered) | Posted January 30, 2011 at 13:22:11

Here is an example of the issues I am having with the comment system. I re-freshed and found the comments on this article Raise the Hammer Response to Mayor's Accusation went from 159 to 173. Great. I looked at the bottom and saw about 3 comments I had not read, the other 11 comments are god knows where in the stream and I have no intention of looking for them anymore. Others may be happy with this change, I am finding it is a huge hindrance to the usability of RTH.

Permalink | Context

By drb (registered) - website | Posted January 30, 2011 at 13:53:50 in reply to Comment 58773

I use the "latest comments" button in "site tools" to keep in touch with new comments and threaded replies. I dunno, it may help.

Permalink | Context

By goin'downtown (registered) | Posted February 01, 2011 at 14:01:25 in reply to Comment 58775

@drb, sorry to ask probably a stupid question, but where are the "site tools"?

Permalink | Context

By drb (registered) - website | Posted February 01, 2011 at 14:12:07 in reply to Comment 59029

No problem, on the right-hand side of the page beneath recent articles and and blogs.

Permalink | Context

By goin'downtown (registered) | Posted February 01, 2011 at 14:55:19 in reply to Comment 59031

Doh! Bifocals on the horizon. Bloody awesome, and thank you!

Permalink | Context

[ - ]

By goin'downtown (registered) | Posted January 30, 2011 at 22:51:40

Sorry to clog up the site with my little tech problems, but I can't "reply"- I have an error message at the bottom (left) of the screen:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.5.30729) Timestamp: Mon, 31 Jan 2011 02:12:57 UTC

Message: 'attr(...)' is null or not an object Line: 98 Char: 5 Code: 0 URI: http://www.raisethehammer.org/static/scr...

I've refreshed, shift refreshed (that sounds vulgar), and deleted my browsing history. I'm on IE8 with Windows XP.

Permalink | Context

[ - ]

By seancb (registered) - website | Posted June 14, 2011 at 09:36:40

Hey Ryan,

The threads are great but we REALLY need the most recent replied-to thread floated to the top.. threaded replies are easily lost otherwise!

There could be an option to turn that off if some people want... but I'd say that the default view should either be flat and chronological OR threaded with most recent threads floated up. threaded chronological is a tough one to follow...

Permalink | Context

View Comments: Nested | Flat

Post a Comment

You must be logged in to comment.

Events Calendar

Recent Articles

Article Archives

Blog Archives

Site Tools

Feeds