Not sure what you mean here. If by question you mean the first post in a topic, the vote button doesn’t appear on the first post. See e.g.: What has cities, but no houses; forests, but no trees; and water, but no fish? - QnA - Angus’ Sandbox
Not sure I agree I think there’s a difference between liking an answer and thinking it’s the correct answer. For example you could like an answer because it’s funny, but not think it’s the best answer to the question.
No doubt, there will be further issues this plugin needs to overcome. As Jeff says in that topic you linked, there are indeed a number of parts of the app that assume the posts are in chronological order. I’ve dealt with some of the key ones in this plugin. But there will probably be more.
Personally, I still consider this plugin to be speculative. I’m planning to use Discourse Solved for questions on my own site, at least for now.
That said, it does actually work. Try it out on your own test instance and it will work as described. If you’re sure you need this style of QnA to work in Discourse, you could hire a dev (or do it yourself) to test all the edge cases and related functionality that the changes to the topic order might affect. Things like: topic entry (i.e. where does the topic scroll to), topic tracking time (i.e. reading time), or how it handles long threads. If after extensive testing you’re satisfied, then use it by all means.
In terms of future compatibility, core Discourse may well introduce new logic that assumes a topic’s posts are in chronological order, in which case this plugin will have to be updated to handle that as well.
That said, there is actually a
sort_order property for Posts in core Discourse which is seperate from
post_number. Currently there are two sort orders in Core Discourse (see
models/post.rb - I don’t think
reverse_order is actually used though):
def self.regular_order order(:sort_order, :post_number) end def self.reverse_order order('sort_order desc, post_number desc') end
The way this plugin works is to introduce a new (slightly more complex) sort order:
answers = posts.where(reply_to_post_number: [nil, '']) .where.not(post_number: 1) .order("vote_count DESC, post_number ASC") count = 1 answers.each do |a| a.update(sort_order: count) comments = posts.where(reply_to_post_number: a.post_number) .order("post_number ASC") if comments.any? comments.each do |c| count += 1 c.update(sort_order: count) end else count += 1 end end
sort_order column is not going away any time soon. It’s existence anticipates that there can be other orders apart from the chronological order (i.e. post number).