Short circuit the instancation of a Message earlier.
This commit is contained in:
parent
7d71a5d59e
commit
81813902da
1 changed files with 4 additions and 3 deletions
|
|
@ -429,14 +429,15 @@ sub new {
|
||||||
return undef unless $messageId;
|
return undef unless $messageId;
|
||||||
|
|
||||||
my $inbox = $session->db->getRow("inbox","messageId",$messageId);
|
my $inbox = $session->db->getRow("inbox","messageId",$messageId);
|
||||||
|
|
||||||
|
#Don't return messages that don't exist
|
||||||
|
return undef unless (scalar(keys %{$inbox}));
|
||||||
|
|
||||||
my $statusValues = $session->db->quickHashRef(
|
my $statusValues = $session->db->quickHashRef(
|
||||||
q{ select isRead, repliedTo, deleted from inbox_messageState where messageId=? and userId=? },
|
q{ select isRead, repliedTo, deleted from inbox_messageState where messageId=? and userId=? },
|
||||||
[$messageId,$userId]
|
[$messageId,$userId]
|
||||||
);
|
);
|
||||||
|
|
||||||
#Don't return messages that don't exist
|
|
||||||
return undef unless (scalar(keys %{$inbox}));
|
|
||||||
|
|
||||||
#Don't return deleted messages
|
#Don't return deleted messages
|
||||||
return undef if($statusValues->{deleted});
|
return undef if($statusValues->{deleted});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue