change "testing" to "no_email" for inbox messages
This commit is contained in:
parent
bfd8f72496
commit
c0fe0a7765
3 changed files with 11 additions and 14 deletions
|
|
@ -101,9 +101,9 @@ Email subject to use rather than inbox message subject.
|
||||||
|
|
||||||
A hash reference containing options for handling the message.
|
A hash reference containing options for handling the message.
|
||||||
|
|
||||||
=head4 testing
|
=head4 no_email
|
||||||
|
|
||||||
If testing is true, then no email will be made or sent. Only
|
If no_email is true, then no email will be made or sent. Only
|
||||||
the inbox message will be made.
|
the inbox message will be made.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
@ -158,16 +158,13 @@ sub create {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( $options->{ to_email } ) {
|
||||||
my $subject = (defined $properties->{emailSubject}) ? $properties->{emailSubject} : $self->{_properties}{subject};
|
my $subject = (defined $properties->{emailSubject}) ? $properties->{emailSubject} : $self->{_properties}{subject};
|
||||||
my $mail = $options->{testing}
|
my $mail = WebGUI::Mail::Send->create($session, {
|
||||||
? undef
|
|
||||||
: WebGUI::Mail::Send->create($session, {
|
|
||||||
toUser=>$self->{_properties}{userId},
|
toUser=>$self->{_properties}{userId},
|
||||||
toGroup=>$self->{_properties}{groupId},
|
toGroup=>$self->{_properties}{groupId},
|
||||||
subject=>$subject,
|
subject=>$subject,
|
||||||
});
|
});
|
||||||
if (defined $mail) {
|
|
||||||
my $preface = "";
|
my $preface = "";
|
||||||
my $fromUser = WebGUI::User->new($session, $properties->{sentBy});
|
my $fromUser = WebGUI::User->new($session, $properties->{sentBy});
|
||||||
#Don't append prefaces to the visitor users or messages that don't specify a user (default case)
|
#Don't append prefaces to the visitor users or messages that don't specify a user (default case)
|
||||||
|
|
@ -179,7 +176,7 @@ sub create {
|
||||||
$mail->addHtml($msg);
|
$mail->addHtml($msg);
|
||||||
$mail->addFooter;
|
$mail->addFooter;
|
||||||
$mail->queue;
|
$mail->queue;
|
||||||
}
|
}
|
||||||
$self->{_session} = $session;
|
$self->{_session} = $session;
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
t/Inbox.t
10
t/Inbox.t
|
|
@ -39,7 +39,7 @@ my $new_message = {
|
||||||
userId => 1,
|
userId => 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
my $message = $inbox->addMessage($new_message,{ testing => 1, });
|
my $message = $inbox->addMessage($new_message,{ no_email => 1, });
|
||||||
isa_ok($message, 'WebGUI::Inbox::Message');
|
isa_ok($message, 'WebGUI::Inbox::Message');
|
||||||
|
|
||||||
ok(defined($message), 'addMessage returned a response');
|
ok(defined($message), 'addMessage returned a response');
|
||||||
|
|
@ -89,7 +89,7 @@ $inbox->addMessage({
|
||||||
userId => 3,
|
userId => 3,
|
||||||
sentBy => $senders[0]->userId,
|
sentBy => $senders[0]->userId,
|
||||||
},{
|
},{
|
||||||
testing => 1,
|
no_email => 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
$inbox->addMessage({
|
$inbox->addMessage({
|
||||||
|
|
@ -97,7 +97,7 @@ $inbox->addMessage({
|
||||||
userId => 3,
|
userId => 3,
|
||||||
sentBy => $senders[1]->userId,
|
sentBy => $senders[1]->userId,
|
||||||
},{
|
},{
|
||||||
testing => 1,
|
no_email => 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
$inbox->addMessage({
|
$inbox->addMessage({
|
||||||
|
|
@ -105,7 +105,7 @@ $inbox->addMessage({
|
||||||
userId => 3,
|
userId => 3,
|
||||||
sentBy => $senders[2]->userId,
|
sentBy => $senders[2]->userId,
|
||||||
},{
|
},{
|
||||||
testing => 1,
|
no_email => 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
$inbox->addMessage({
|
$inbox->addMessage({
|
||||||
|
|
@ -113,7 +113,7 @@ $inbox->addMessage({
|
||||||
userId => 3,
|
userId => 3,
|
||||||
sentBy => $senders[2]->userId,
|
sentBy => $senders[2]->userId,
|
||||||
},{
|
},{
|
||||||
testing => 1,
|
no_email => 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
is(scalar @{ $inbox->getMessagesForUser($admin) }, 4, 'Added 3 messages by various users');
|
is(scalar @{ $inbox->getMessagesForUser($admin) }, 4, 'Added 3 messages by various users');
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ my $expectedCodes = {
|
||||||
cmp_deeply( $statusCodes, $expectedCodes, 'statusCodes as a class method works');
|
cmp_deeply( $statusCodes, $expectedCodes, 'statusCodes as a class method works');
|
||||||
undef $statusCodes;
|
undef $statusCodes;
|
||||||
|
|
||||||
my $tempMessage = WebGUI::Inbox::Message->create($session, {}, {testing => 1});
|
my $tempMessage = WebGUI::Inbox::Message->create($session, {}, {no_email => 1});
|
||||||
$statusCodes = $tempMessage->statusCodes;
|
$statusCodes = $tempMessage->statusCodes;
|
||||||
cmp_deeply( $statusCodes, $expectedCodes, 'statusCodes as an object method works');
|
cmp_deeply( $statusCodes, $expectedCodes, 'statusCodes as an object method works');
|
||||||
undef $statusCodes;
|
undef $statusCodes;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue