|
@@ 103-122 (lines=20) @@
|
| 100 |
|
)); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
protected function sendApprovedEmail(DNDeployment $deployment) { |
| 104 |
|
if (!$this->canSendEmail($deployment)) { |
| 105 |
|
return false; |
| 106 |
|
} |
| 107 |
|
$deployer = $deployment->Deployer(); |
| 108 |
|
$approver = $deployment->Approver(); |
| 109 |
|
|
| 110 |
|
$email = Email::create(); |
| 111 |
|
$email->setTo(sprintf('%s <%s>', $deployer->Name, $deployer->Email)); |
| 112 |
|
$email->setSubject(sprintf('Your deployment has been approved by %s', $approver->Name)); |
| 113 |
|
$email->setTemplate('DeploymentApprovedEmail'); |
| 114 |
|
$email->populateTemplate($deployment); |
| 115 |
|
$email->send(); |
| 116 |
|
|
| 117 |
|
$deployment->log()->write(sprintf( |
| 118 |
|
'Deployment approved email sent to requester %s <%s>', |
| 119 |
|
$deployer->Name, |
| 120 |
|
$deployer->Email |
| 121 |
|
)); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
protected function sendRejectedEmail(DNDeployment $deployment) { |
| 125 |
|
if (!$this->canSendEmail($deployment)) { |
|
@@ 146-163 (lines=18) @@
|
| 143 |
|
)); |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
protected function sendApprovalCancellationEmail(DNDeployment $deployment) { |
| 147 |
|
if (!$this->canSendEmail($deployment)) { |
| 148 |
|
return false; |
| 149 |
|
} |
| 150 |
|
$deployer = $deployment->Deployer(); |
| 151 |
|
$approver = $deployment->Approver(); |
| 152 |
|
|
| 153 |
|
$to = sprintf('%s <%s>, %s <%s>', $deployer->Name, $deployer->Email, $approver->Name, $approver->Email); |
| 154 |
|
|
| 155 |
|
$email = Email::create(); |
| 156 |
|
$email->setTo($to); |
| 157 |
|
$email->setSubject('Deployment approval has been cancelled'); |
| 158 |
|
$email->setTemplate('DeploymentApprovalCancellationEmail'); |
| 159 |
|
$email->populateTemplate($deployment); |
| 160 |
|
$email->send(); |
| 161 |
|
|
| 162 |
|
$deployment->log()->write(sprintf('Deployment approval cancellation email sent to %s', $to)); |
| 163 |
|
} |
| 164 |
|
|
| 165 |
|
} |
| 166 |
|
|