lib/sup/thread.rb in sup-0.15.0 vs lib/sup/thread.rb in sup-0.15.1

- old
+ new

@@ -170,11 +170,11 @@ @children = [] end def each_with_stuff parent=nil yield self, 0, parent - @children.each do |c| + @children.sort_by(&:sort_key).each do |c| c.each_with_stuff(self) { |cc, d, par| yield cc, d + 1, par } end end def descendant_of? o @@ -236,9 +236,13 @@ end f.puts "#{id} #{line}"#[0 .. (105 - indent)] indent += 3 @children.each { |c| c.dump_recursive f, indent, false, self } + end + + def sort_key + empty? ? [Time.now.to_i, ""] : [@message.date.to_i, @message.id] end end ## A set of threads, so a forest. Is integrated with the index and ## builds thread structures by reading messages from it.