Added the notifications for the code review.
This commit is contained in:
parent
2ec653ad43
commit
ee5044fb1c
@ -179,6 +179,26 @@ class IDF_Form_ReviewCreate extends Pluf_Form
|
||||
$patch->commit = self::findCommit($this->cleaned_data['commit']);
|
||||
$patch->patch = $this->cleaned_data['patch'];
|
||||
$patch->create();
|
||||
// Send create notification
|
||||
if ('' != $this->project->getConf()->getVal('review_notification_email', '')) {
|
||||
$context = new Pluf_Template_Context(
|
||||
array(
|
||||
'review' => $review,
|
||||
'patch' => $patch,
|
||||
'comments' => array(),
|
||||
'project' => $this->project,
|
||||
'url_base' => Pluf::f('url_base'),
|
||||
)
|
||||
);
|
||||
$tmpl = new Pluf_Template('idf/review/review-created-email.txt');
|
||||
$text_email = $tmpl->render($context);
|
||||
$email = new Pluf_Mail(Pluf::f('from_email'),
|
||||
$this->project->getConf()->getVal('review_notification_email'),
|
||||
sprintf(__('New Code Review %s - %s (%s)'),
|
||||
$review->id, $review->summary, $this->project->shortname));
|
||||
$email->addTextMessage($text_email);
|
||||
$email->sendMail();
|
||||
}
|
||||
return $review;
|
||||
}
|
||||
|
||||
|
@ -177,16 +177,23 @@ class IDF_Views_Review
|
||||
$tmpl = new Pluf_Template('idf/review/review-updated-email.txt');
|
||||
$text_email = $tmpl->render($context);
|
||||
$email = new Pluf_Mail_Batch(Pluf::f('from_email'));
|
||||
$to_emails = array();
|
||||
foreach ($reviewers as $user) {
|
||||
if ($user->id != $request->user->id) {
|
||||
$to_emails[] = $user->email;
|
||||
}
|
||||
}
|
||||
if ('' != $request->conf->getVal('review_notification_email', '')) {
|
||||
$to_emails[] = $request->conf->getVal('review_notification_email');
|
||||
}
|
||||
foreach ($to_emails as $oemail) {
|
||||
$email->setSubject(sprintf(__('Updated Code Review %s - %s (%s)'),
|
||||
$review->id, $review->summary, $prj->shortname));
|
||||
$email->setTo($user->email);
|
||||
$email->setTo($oemail);
|
||||
$email->setReturnPath(Pluf::f('from_email'));
|
||||
$email->addTextMessage($text_email);
|
||||
$email->sendMail();
|
||||
}
|
||||
}
|
||||
$email->close();
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
|
16
src/IDF/templates/idf/review/review-created-email.txt
Normal file
16
src/IDF/templates/idf/review/review-created-email.txt
Normal file
@ -0,0 +1,16 @@
|
||||
{trans 'Hello,'}
|
||||
|
||||
{blocktrans}The following review has been created:{/blocktrans}
|
||||
|
||||
{$review.id} - {$review.summary|safe}
|
||||
{trans 'Project:'} {$project.name|safe}
|
||||
{trans 'Status:'} {$review.get_status.name}
|
||||
{trans 'Reported by:'} {$review.get_submitter|safe}
|
||||
{trans 'URL:'} {$url_base}{url 'IDF_Views_Review::view', array($project.shortname, $review.id)}
|
||||
{assign $tags = $review.get_tags_list()}{if $tags.count()}{trans 'Labels:'}
|
||||
{foreach $tags as $tag} {$tag.class|safe}:{$tag.name|safe}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
--
|
||||
{trans 'Review:'} {$url_base}{url 'IDF_Views_Review::view', array($project.shortname, $review.id)}
|
Loading…
Reference in New Issue
Block a user