How do I add topic posts nested under topic list items hosted on discourse.org? ie Topic list as feed

Hi all,

So this week we started our first sprint on customising our discourse theme, we knew that we were going to be changing a fair number of files as the designs are quite different to the discourse themes.

Our approach is very simple: try to achieve what we need to with SASS alone and where needed over-ride the respective .hbs/.hbr file. We know the latter introduces some extra maintenance risk (if the attributes being passed to the view are either renamed or removed our templates will break). We weighed up the risk of this happening against maintaining our own infrastructure and concluded that hosting on discourse.org delivers more value to our non-profit client. We are going to add some monitoring code to the site and have a response plan in place for when this does happen - also should it happen we reckon it would most likely be an easy fix.

So onto the meat of this post. We need to workout how to turn the Topics List view into a feed like experience. ie under each Topic the replying posts are rendered as comments.

Heres a picture of what we need to build (currently showing just 1 comment per topic - we will need to show more then this sometimes)

Where we are at

So @iainbamboo went diving into things to work out:

  1. Is the post data already available in the topic list and we just need to change the template → No its not
  2. How do we add each topics post data to the List so we can render it in the template?
    1. Is this even the right approach?
    2. Do we look to modify the ruby code to add it to the model that is sent through (possibly as a plugin) along these lines Discourse Timeline. If we make a plugin can we use it on discourse.org?
    3. Do we fetch the data from ember and just take the hit of having slower loads as multiple ajax requests are made to the server to get each topics posts (runs the risk of hitting rate limits)
    4. Can you even do this without modifying ruby code?

After looking around a fair amount - reading through the discourse dev guides and going through the source code, we concluded that we needed some expert advise on the best way to tackle this.

And now we are here :slight_smile:

You’d run into all sorts of performance and rate limit issues trying to do this on the front-end in a theme… maybe someone more familiar with the back-end can chime in, but I think you’ll definitely need to build a plugin.

8 Likes