Prospective Feature: Highlight Posts That Surpass Defined "Likes" Threshold

The query in the plugin targets a single post, and the behavior is modelled around a single result:

    most_liked_post = topic.posts.joins(user: [group_users:[:group]]).where(groups: {name: (params[:group].split("|"))}).where.not(sort_order: 1).order(like_count: :desc).limit(1).first

You could probably replace the .limit(1).first with a .where(like_count:) is greater than your likes threshold. However you would also have to strip out the link to the (single) top post.

1개의 좋아요