Present messages in ascending order from DB to make message order in UI predictable.

This commit is contained in:
Samuel Cochran 2011-06-01 00:40:35 +08:00
parent 72a761c198
commit bd1bfc47cf
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ module MailCatcher::Mail
end
def messages
@@messages_query ||= db.prepare "SELECT id, sender, recipients, subject, size, created_at FROM message ORDER BY created_at DESC"
@@messages_query ||= db.prepare "SELECT id, sender, recipients, subject, size, created_at FROM message ORDER BY created_at ASC"
@@messages_query.execute.map do |row|
Hash[row.fields.zip(row)].tap do |message|
message["recipients"] &&= ActiveSupport::JSON.decode message["recipients"]