summaryrefslogtreecommitdiff
path: root/lib/JWebmail/Model/Driver/MockJSON.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/JWebmail/Model/Driver/MockJSON.pm')
-rw-r--r--lib/JWebmail/Model/Driver/MockJSON.pm5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/JWebmail/Model/Driver/MockJSON.pm b/lib/JWebmail/Model/Driver/MockJSON.pm
index aafc74d..258246d 100644
--- a/lib/JWebmail/Model/Driver/MockJSON.pm
+++ b/lib/JWebmail/Model/Driver/MockJSON.pm
@@ -62,9 +62,8 @@ sub communicate {
my $s = sub {
my $sort_by = $args{args}->[LIST_SORT];
my $rev = $sort_by !~ m/^![[:lower:]]+/ ? 1 : -1;
- $sort_by =~ s/!//;
- $sort_by = "date_received" if $sort_by eq "date";
- return ($a->{$sort_by} cmp $b->{$sort_by}) * $rev;
+ $sort_by =~ s/^!//;
+ return (($a->{$sort_by}||$a->{head}{$sort_by}) cmp ($b->{$sort_by}||$b->{head}{$sort_by})) * $rev;
};
return ([sort { &$s } @{ $self->list_reply }[$args{args}->[LIST_START]..$args{args}->[LIST_END]]], 0);
}