(Ab)using bumped_at to achieve Reddit like sorting

I am running a news/political discussion forum on discourse. The issue I am seeing is that the default sorting that discourse comes with results in complete chaos for my use case since the age of topic matters a lot. For a forum such as mine, Reddit style sorting makes the most sense however my understanding is that there is no straightforward way of achieving it.

I am wondering if it is possible to (ab)use bumped_at to achieve Reddit sorting by doing something like:

def topic_hotness(created_at, like_count)
   /**
      This function translates created_at and like_count
      into bumped_at date using a mathematical formula
      similar to the one used by Reddit. Consider bumped_at
      as a date until which we need the topic to be in the top 10
      given its creation date and number of likes.
   */
end

add_model_callback(Topic, :before_save) do
   self.bumped_at = topic_hotness(self.created_at, self.like_count)
end

Is this going to work? And what features might it break which would need to be addressed. I saw somewhere in the discourse code base where an exception is thrown if bumped_at is in the future. Depending on the formula, using this scheme can result in bumped_at dates in the future. Any thoughts?

Anyone?

Sorry about the bump.

No. Use one of the many Reddit clones out there if you want Reddit.

Unfortunately there is NOTHING comparable to discourseā€™s quality out there so discourse is my only option. In fact, discourse does almost everything needed for that use case, it is just the homepage sorting that is the missing piece. I have seen in past similar asks (though only a few), so maybe this will help more people in the future.

2 Likes

Well, that is awfully kind of you to say :wink:

But we are strictly commited to chronological sorting in conversations, and only a thin veneer of threading. You may look at the Solved plugin, perhaps?

1 Like

One alternative is to set your siteā€™s homepage to /top or /top/daily.

2 Likes

Haha. I can say that because I am getting a very good response from my community. The reddit clones out there are not even worth trying.

I am not sure if I understand how the Solved plugin is related to this problem. Does it temper with bump date?

This has its own issues, the timeline has to be infinite scroll to keep the user engaged. Most of my users will bounce off rather than navigating into the categories.

I think what I will do next is to experiment in devo to see what issues I will experience if I override bumped_at and see if I can accept them as tradeoffs. I havenā€™t looked into the code yet but it seems like the last visit marker will go crazy so I will have to suppress it. Also, I think the ā€œnew or updated topicsā€ will be ruined so that might also need some overrides or suppression.

I will share my experience on this thread in case someone else is interested too. Let me know if you guys can think of off the top of your head any other issues it will cause.

1 Like