From c0fe0a77652fac22ef6cbfe617561254f92023c4 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Fri, 31 Jul 2009 21:02:51 +0000 Subject: [PATCH] change "testing" to "no_email" for inbox messages --- lib/WebGUI/Inbox/Message.pm | 13 +++++-------- t/Inbox.t | 10 +++++----- t/Inbox/Message.t | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/WebGUI/Inbox/Message.pm b/lib/WebGUI/Inbox/Message.pm index 41850fc51..594bf93fc 100644 --- a/lib/WebGUI/Inbox/Message.pm +++ b/lib/WebGUI/Inbox/Message.pm @@ -101,9 +101,9 @@ Email subject to use rather than inbox message subject. 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. =cut @@ -158,16 +158,13 @@ sub create { ); } } - + if ( $options->{ to_email } ) { my $subject = (defined $properties->{emailSubject}) ? $properties->{emailSubject} : $self->{_properties}{subject}; - my $mail = $options->{testing} - ? undef - : WebGUI::Mail::Send->create($session, { + my $mail = WebGUI::Mail::Send->create($session, { toUser=>$self->{_properties}{userId}, toGroup=>$self->{_properties}{groupId}, subject=>$subject, }); - if (defined $mail) { my $preface = ""; 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) @@ -179,7 +176,7 @@ sub create { $mail->addHtml($msg); $mail->addFooter; $mail->queue; - } + } $self->{_session} = $session; bless $self, $class; } diff --git a/t/Inbox.t b/t/Inbox.t index f56aa8983..fee73ff14 100644 --- a/t/Inbox.t +++ b/t/Inbox.t @@ -39,7 +39,7 @@ my $new_message = { 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'); ok(defined($message), 'addMessage returned a response'); @@ -89,7 +89,7 @@ $inbox->addMessage({ userId => 3, sentBy => $senders[0]->userId, },{ - testing => 1, + no_email => 1, }); $inbox->addMessage({ @@ -97,7 +97,7 @@ $inbox->addMessage({ userId => 3, sentBy => $senders[1]->userId, },{ - testing => 1, + no_email => 1, }); $inbox->addMessage({ @@ -105,7 +105,7 @@ $inbox->addMessage({ userId => 3, sentBy => $senders[2]->userId, },{ - testing => 1, + no_email => 1, }); $inbox->addMessage({ @@ -113,7 +113,7 @@ $inbox->addMessage({ userId => 3, sentBy => $senders[2]->userId, },{ - testing => 1, + no_email => 1, }); is(scalar @{ $inbox->getMessagesForUser($admin) }, 4, 'Added 3 messages by various users'); diff --git a/t/Inbox/Message.t b/t/Inbox/Message.t index 36c026535..c35c9d104 100644 --- a/t/Inbox/Message.t +++ b/t/Inbox/Message.t @@ -65,7 +65,7 @@ my $expectedCodes = { cmp_deeply( $statusCodes, $expectedCodes, 'statusCodes as a class method works'); undef $statusCodes; -my $tempMessage = WebGUI::Inbox::Message->create($session, {}, {testing => 1}); +my $tempMessage = WebGUI::Inbox::Message->create($session, {}, {no_email => 1}); $statusCodes = $tempMessage->statusCodes; cmp_deeply( $statusCodes, $expectedCodes, 'statusCodes as an object method works'); undef $statusCodes;