summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de>2021-08-24 12:21:39 +0200
committerJannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de>2021-08-24 12:21:39 +0200
commitbae4c2afa97a9c51eb04d0d52f025e73fd2031be (patch)
tree1ed845063566915793688fe6123c78b48ed12288 /lib
parent2388747fbf954de990862a6c01713d50823e8725 (diff)
corrected sort by date in mock json
Diffstat (limited to 'lib')
-rw-r--r--lib/JWebmail/Model/Driver/MockJSON.pm11
-rw-r--r--lib/JWebmail/Model/ReadMails.pm2
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/JWebmail/Model/Driver/MockJSON.pm b/lib/JWebmail/Model/Driver/MockJSON.pm
index 99df346..aafc74d 100644
--- a/lib/JWebmail/Model/Driver/MockJSON.pm
+++ b/lib/JWebmail/Model/Driver/MockJSON.pm
@@ -8,15 +8,15 @@ use Mojo::JSON qw(decode_json);
use constant {
- VALID_USER => 'me@mockjson.com',
+ VALID_USER => 'mockjson@example.com',
VALID_PW => 'vwxyz',
};
use constant {
- LIST_START => 0,
- LIST_END => 1,
- LIST_SORT => 2,
- LIST_FOLDER => 3,
+ LIST_START => 0,
+ LIST_END => 1,
+ LIST_SORT => 2,
+ LIST_FOLDER => 3,
};
sub _read_json_file {
@@ -63,6 +63,7 @@ sub communicate {
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;
};
return ([sort { &$s } @{ $self->list_reply }[$args{args}->[LIST_START]..$args{args}->[LIST_END]]], 0);
diff --git a/lib/JWebmail/Model/ReadMails.pm b/lib/JWebmail/Model/ReadMails.pm
index ddca7ce..e541de1 100644
--- a/lib/JWebmail/Model/ReadMails.pm
+++ b/lib/JWebmail/Model/ReadMails.pm
@@ -138,7 +138,7 @@ __END__
=head1 NAME
-ReadMails - Read recieved mails
+ReadMails - Read received mails
=head1 SYNOPSIS