From d5fcba72f75e74c89affe391b71c519a7d5aff0d Mon Sep 17 00:00:00 2001 From: Darin McBride Date: Sat, 19 Dec 2015 09:24:50 -0700 Subject: [PATCH] Fix trash_messages_where --- lib/Lacuna/RPC/Inbox.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Lacuna/RPC/Inbox.pm b/lib/Lacuna/RPC/Inbox.pm index 1fa7cbd2..f93eec87 100644 --- a/lib/Lacuna/RPC/Inbox.pm +++ b/lib/Lacuna/RPC/Inbox.pm @@ -19,8 +19,6 @@ use PerlX::Maybe qw(provided); # * from => false if from real empire is not to be looked at. sub messages_rs { my ($self, $session, $message_ids, %opts) = @_; - my $dtf = Lacuna->db->storage->datetime_parser; - my $now = $dtf->format_datetime(DateTime->now); # build a list of filters to OR together. my @or = { 'me.to_id' => $session->empire->id }; @@ -28,7 +26,7 @@ sub messages_rs { not exists $opts{from} or $opts{from}; push @or, { 'sitterauths.sitter_id' => $session->empire->id, - 'sitterauths.expiry' => { '<' => $now }, + 'sitterauths.expiry' => { '>=' => \q[UTC_TIMESTAMP()] }, 'me.tag' => { '!=' => 'Correspondence' }, } unless $session->_is_sitter; @@ -154,8 +152,8 @@ sub trash_messages_where { $where{tag} = $spec->{tags} if $spec->{tags} && ref $spec->{tags} eq 'ARRAY'; $where{tag} ||= $spec->{tag} if $spec->{tag} && !ref $spec->{tag}; $where{from_name} = [ $spec->{from} ] if $spec->{from} && !ref $spec->{from}; - $where{empire_id} = $empire->id unless $spec->{all_babies}; - $where{empire_id} = $spec->{empire_id} if $spec->{empire_id} and !ref $spec->{empire_id} or none { ref $_ } @{$spec->{empire_id}}; + $where{to_id} = $empire->id unless $spec->{all_babies}; + $where{to_id} = $spec->{empire_id} if $spec->{empire_id} and (!ref $spec->{empire_id} or none { ref $_ } @{$spec->{empire_id}}); if ($spec->{subject}) { -- 2.51.2