Show only liked posts in a thread

AI-generated summary

In a feature discussion titled ‘Show only liked posts in a thread,’ rubo77 proposes filtering threads to display only posts with at least one like, to help users quickly grasp key contributions in long threads. Moter8 notes this resembles the existing ‘Summarize thread’ feature, but rubo77 clarifies that ‘Summarize’ sometimes hides liked posts, raising questions about its filtering logic. Mittineague investigates and finds the summarize mechanism isn’t fully transparent — it may consider factors like moderator likes, trust levels, post length, or cross-references, but the exact code is elusive. rubo77 suggests reviewing the source code, pointing to a GitHub file: discourse/lib/filter_best_posts.rb. Mittineague analyzes the code and confirms it filters posts based on moderator likes, trust levels, and reply counts — not just total likes. codinghorror clarifies this isn’t part of core functionality. The discussion remains open, with rubo77 seeking documentation on the summarize algorithm. The core issue is a desire for a user-facing filter to show only liked posts — distinct from the current summarize logic — to improve thread navigation.

It would come handy if you want to get an overview of a topic with lots of posts if you could narrow down the view to only posts that have at least one like.

Alternatively It would already help if all posts withoul likes would be shown minimized somehow, (maybe only the first line and a more-button)

How could this be implemented?

That’s basically the summarize thread feature which already exists :blush:

But If I use Summarize it also hides some posts, that have a “like”.

What is the exact mechanism for “summarize”?

Good question. I looked a very little for the code that does the logic but didn’t find it.

Using the topic I used to answer your post in the other topic

It says there is a total of 116 Likes in the topic. If my math is correct, all of the posts in the Summary have Likes, but only add up to 78

So some posts that received Likes did get collapsed.

It seems that Frequent poster may be in play, and possibly OP.

Some of the Collapsed posts had from 1 to 4 Likes.
Some were shorter replies, some not so short.
Some were “infrequent” posters, some were not.
Some had cross-reference links, some did not.
And I’m guessing there may be some kind of “keyword” matching involved.

I can’t grasp the logic and would need to see the code involved.

2 Me gusta

Which exact code is involved? (I could take a look at it)

That’s what I need to know, where is the code?

No, that is not our repo.

It could be in here: discourse/lib/filter_best_posts.rb at main · discourse/discourse · GitHub

If that is the right file (and not used only for Digest inclusion or the Top pages) then it looks as though it uses Likes by Moderators and posts by a members Trust Level

  def filter
    @posts =  if @min_replies && @topic.posts_count < @min_replies + 1
                []
              else
                filter_posts_liked_by_moderators
                setup_posts
                filter_posts_based_on_trust_level
                filter_posts_based_on_score
                sort_posts
              end
  end

is this documented somewhere?