Added review update notification.
This commit is contained in:
parent
fefff591b6
commit
da23f2b915
@ -153,11 +153,41 @@ class IDF_Views_Review
|
||||
));
|
||||
if ($form->isValid()) {
|
||||
$patch = $form->save();
|
||||
$review = $patch->get_review();
|
||||
$urlr = Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
|
||||
array($prj->shortname, $patch->get_review()->id));
|
||||
$request->user->setMessage(sprintf(__('Your <a href="%s">code review %d</a> has been published.'), $urlr, $patch->get_review()->id));
|
||||
array($prj->shortname, $review->id));
|
||||
$request->user->setMessage(sprintf(__('Your <a href="%s">code review %d</a> has been published.'), $urlr, $review->id));
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Review::index',
|
||||
array($prj->shortname));
|
||||
// Get the list of reviewers + submitter
|
||||
$reviewers = $review->get_reviewers_list();
|
||||
if (!Pluf_Model_InArray($review->get_submitter(), $reviewers)) {
|
||||
$reviewers[] = $review->get_submitter();
|
||||
}
|
||||
$comments = $patch->get_filecomments_list(array('order' => 'id DESC'));
|
||||
$context = new Pluf_Template_Context(
|
||||
array(
|
||||
'review' => $review,
|
||||
'patch' => $patch,
|
||||
'comments' => $comments,
|
||||
'project' => $prj,
|
||||
'url_base' => Pluf::f('url_base'),
|
||||
)
|
||||
);
|
||||
$tmpl = new Pluf_Template('idf/review/review-updated-email.txt');
|
||||
$text_email = $tmpl->render($context);
|
||||
$email = new Pluf_Mail_Batch(Pluf::f('from_email'));
|
||||
foreach ($reviewers as $user) {
|
||||
if ($user->id != $request->user->id) {
|
||||
$email->setSubject(sprintf(__('Updated Code Review %s - %s (%s)'),
|
||||
$review->id, $review->summary, $prj->shortname));
|
||||
$email->setTo($user->email);
|
||||
$email->setReturnPath(Pluf::f('from_email'));
|
||||
$email->addTextMessage($text_email);
|
||||
$email->sendMail();
|
||||
}
|
||||
}
|
||||
$email->close();
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
} else {
|
||||
|
24
src/IDF/templates/idf/review/review-updated-email.txt
Normal file
24
src/IDF/templates/idf/review/review-updated-email.txt
Normal file
@ -0,0 +1,24 @@
|
||||
{trans 'Hello,'}
|
||||
|
||||
{blocktrans}The following review has been updated:{/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 'Comments (last first):'}
|
||||
|
||||
{foreach $comments as $c}{assign $who = $c.get_submitter()}# {blocktrans}By {$who|safe}, {$c.creation_dtime|date}, on file:
|
||||
{$c.cfile|safe}
|
||||
{/blocktrans}
|
||||
|
||||
{$c.content|safe}
|
||||
|
||||
{/foreach}
|
||||
|
||||
--
|
||||
{trans 'Review:'} {$url_base}{url 'IDF_Views_Review::view', array($project.shortname, $review.id)}
|
Loading…
Reference in New Issue
Block a user