|
@@ 111-130 (lines=20) @@
|
| 108 |
|
)); |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
protected function sendApprovedEmail(DNDeployment $deployment) { |
| 112 |
|
if (!$this->canSendEmail($deployment)) { |
| 113 |
|
return false; |
| 114 |
|
} |
| 115 |
|
$deployer = $deployment->Deployer(); |
| 116 |
|
$approver = $deployment->Approver(); |
| 117 |
|
|
| 118 |
|
$email = Email::create(); |
| 119 |
|
$email->setTo(sprintf('%s <%s>', $deployer->Name, $deployer->Email)); |
| 120 |
|
$email->setSubject(sprintf('Your deployment has been approved by %s', $approver->Name)); |
| 121 |
|
$email->setTemplate('DeploymentApprovedEmail'); |
| 122 |
|
$email->populateTemplate($deployment); |
| 123 |
|
$email->send(); |
| 124 |
|
|
| 125 |
|
$deployment->log()->write(sprintf( |
| 126 |
|
'Deployment approved email sent to requester %s <%s>', |
| 127 |
|
$deployer->Name, |
| 128 |
|
$deployer->Email |
| 129 |
|
)); |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
protected function sendRejectedEmail(DNDeployment $deployment) { |
| 133 |
|
if (!$this->canSendEmail($deployment)) { |
|
@@ 154-171 (lines=18) @@
|
| 151 |
|
)); |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
protected function sendApprovalCancellationEmail(DNDeployment $deployment) { |
| 155 |
|
if (!$this->canSendEmail($deployment)) { |
| 156 |
|
return false; |
| 157 |
|
} |
| 158 |
|
$deployer = $deployment->Deployer(); |
| 159 |
|
$approver = $deployment->Approver(); |
| 160 |
|
|
| 161 |
|
$to = sprintf('%s <%s>, %s <%s>', $deployer->Name, $deployer->Email, $approver->Name, $approver->Email); |
| 162 |
|
|
| 163 |
|
$email = Email::create(); |
| 164 |
|
$email->setTo($to); |
| 165 |
|
$email->setSubject('Deployment approval has been cancelled'); |
| 166 |
|
$email->setTemplate('DeploymentApprovalCancellationEmail'); |
| 167 |
|
$email->populateTemplate($deployment); |
| 168 |
|
$email->send(); |
| 169 |
|
|
| 170 |
|
$deployment->log()->write(sprintf('Deployment approval cancellation email sent to %s', $to)); |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
} |
| 174 |
|
|