|
@@ 89-109 (lines=21) @@
|
| 86 |
|
return true; |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
protected function sendSubmittedEmail(DNDeployment $deployment) { |
| 90 |
|
if (!$this->canSendEmail($deployment)) { |
| 91 |
|
return false; |
| 92 |
|
} |
| 93 |
|
$deployer = $deployment->Deployer(); |
| 94 |
|
$approver = $deployment->Approver(); |
| 95 |
|
|
| 96 |
|
$email = Email::create(); |
| 97 |
|
$email->setTo(sprintf('%s <%s>', $approver->Name, $approver->Email)); |
| 98 |
|
$email->replyTo(sprintf('%s <%s>', $deployer->Name, $deployer->Email)); |
| 99 |
|
$email->setSubject(sprintf('%s has submitted a deployment for your approval', $deployer->Name)); |
| 100 |
|
$email->setTemplate('DeploymentSubmittedEmail'); |
| 101 |
|
$email->populateTemplate($deployment); |
| 102 |
|
$email->send(); |
| 103 |
|
|
| 104 |
|
$deployment->log()->write(sprintf( |
| 105 |
|
'Deployment submitted email sent to approver %s <%s>', |
| 106 |
|
$approver->Name, |
| 107 |
|
$approver->Email |
| 108 |
|
)); |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
protected function sendApprovedEmail(DNDeployment $deployment) { |
| 112 |
|
if (!$this->canSendEmail($deployment)) { |
|
@@ 132-152 (lines=21) @@
|
| 129 |
|
)); |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
protected function sendRejectedEmail(DNDeployment $deployment) { |
| 133 |
|
if (!$this->canSendEmail($deployment)) { |
| 134 |
|
return false; |
| 135 |
|
} |
| 136 |
|
$deployer = $deployment->Deployer(); |
| 137 |
|
$approver = $deployment->Approver(); |
| 138 |
|
|
| 139 |
|
$email = Email::create(); |
| 140 |
|
$email->setTo(sprintf('%s <%s>', $deployer->Name, $deployer->Email)); |
| 141 |
|
$email->replyTo(sprintf('%s <%s>', $approver->Name, $approver->Email)); |
| 142 |
|
$email->setSubject(sprintf('Your deployment has been rejected by %s', $approver->Name)); |
| 143 |
|
$email->setTemplate('DeploymentRejectedEmail'); |
| 144 |
|
$email->populateTemplate($deployment); |
| 145 |
|
$email->send(); |
| 146 |
|
|
| 147 |
|
$deployment->log()->write(sprintf( |
| 148 |
|
'Deployment rejected email sent to requester %s <%s>', |
| 149 |
|
$deployer->Name, |
| 150 |
|
$deployer->Email |
| 151 |
|
)); |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
protected function sendApprovalCancellationEmail(DNDeployment $deployment) { |
| 155 |
|
if (!$this->canSendEmail($deployment)) { |