From bae4c2afa97a9c51eb04d0d52f025e73fd2031be Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Tue, 24 Aug 2021 12:21:39 +0200 Subject: corrected sort by date in mock json --- lib/JWebmail/Model/Driver/MockJSON.pm | 11 ++++++----- lib/JWebmail/Model/ReadMails.pm | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3