Discourse Hot Topics

:information_source: Discourse now features a /hot topic list in core that can be added to your top menu

Repository: GitHub - danskdynamit/discourse-hot-topics

This plugin creates a “Hot” sorting criteria and builds a custom topic list based on the result of the following formula:

likes / ((hours since creation + 2) ^ gravity)

Things to note:

  • The default gravity multiplier is 1.5 but you can adjust this in the settings for the plugin.
  • You can add “hot” to the list of menu items to make it easier to access.
  • There is also the option to add ?order=hot to a URL to create your own links.
  • Once enabled, the hot rating is recalculated every 30 minutes so it will take a bit of time to take effect at first. If you want to accelerate this, you can log in to Sidekiq and manually trigger the HotRating job.

This work was graciously sponsored by @commonpawn and @Oskar. Kudos to them for making this happen.

The following topics lend more background to why this exists:

https://meta.discourse.org/t/topic-list-previews/41630/299

24 лайка

In our community, we need hottest topic for a specific category. can this plugin do that?

Yes.

Go to the category page you want and then select Hot from the menu. The URL will look similar to this: yourdomain.com/c/CATEGORY/l/hot.

6 лайков

Hello @joebuhlig,

Is it possible to change the frequence of the HotRating job in sidekiq ?

Give this a try:

It adds a setting hot_topics_calc_period that lets you set the period (in minutes). Note that you’ll need to do a rebuild every time this setting is changed before it will take effect.

6 лайков

Thank you @joebuhlig !

1 лайк

Hello Joe,

Is the “staff like weight” parameter is taken into account in the hot topic plugin ?

This option is in the parameters “other” tab.

Currently, it is not.

1 лайк

6 posts were split to a new topic: Prevent fast and short replies when a flame war is ongoing

Hello @joebuhlig,

After some tests, i’m pretty sure that replies likes, are taken into account in the formula. I think it’ll be better and more logical, to only takes likes of the first post.

Don’t you think ?

Yes. It does count likes on all posts. It’s beyond me on whether or not that’s a good way to do it. The formula is a copy from other models. @commonpawn and @Oskar, do either of you have a strong leaning here?

1 лайк

@joebuhlig if you have a bit time and if @commonpawn and @Oskar are ok, i can sponsorize this job, to add an option to take or not in account replies likes.

6 лайков

Just sent you a PM. :wink:

Sometimes things work out really quick. Thanks to @kam44 for making this happen.

You can now choose to use only the likes on the original post in the calculation as opposed to likes across all replies.

https://github.com/danskdynamit/discourse-hot-topics/commit/fcb645064cbea9ff2bc06099f730541c01259773

9 лайков

The plugin works well, but does it do the “x new posts. Click to refresh” live updating that is done on the core lists? It would be nice if it could (not so much to change the order of the posts, but to notify the users as to which posts have replies…)

I’m getting a 500 (/hot route) error after installing it and I’ve run the HotRating job, I’m missing something?

Regarding this:

Do you think Hot Topics could be made to support Feature Voting as well? Or would it be easier if Feature Voting just comes with its own concept of “Hot” sorting?

I see no reason for a cascade of dependency, feature voting can take care of itself

5 лайков

При использовании этого плагина возникла ошибка.

Я добавил плагин в папку плагинов в Discourse, затем запустил свой Rails-сервер командой bundle exec rails server и столкнулся с этой ошибкой. Только этот плагин вызывает подобные ошибки.

1: from …/plugins/discourse-hot-topics/plugin.rb:98:in block in activate!' .../plugins/discourse-hot-topics/plugin.rb:100:in module:Jobs’: uninitialized constant Jobs:: Jobs::Scheduled
Did you mean? Scheduler (NameError)

** НЕСОВМЕСТИМЫЙ ПЛАГИН **

Я новичок в Discourse, возможно, я допускаю какую-то фатальную ошибку? Или кто-то ещё сталкивается с этой же проблемой.

Я использую Ruby 2.6.1 и Rails 6.0.0, последнюю версию Discourse из Github.

5 лайков

Измените

class HotRating < Jobs::Scheduled

на

class HotRating < Scheduled

Это сработало для меня. Я считаю, что проблема возникает из-за того, что этот класс уже обернут в модуль ::Jobs, поэтому нам не нужно указывать модуль повторно.

1 лайк