Added the notification for the commits.

This commit is contained in:
Loic d'Anterroches 2009-01-28 15:20:41 +01:00
parent be7cbabe8d
commit fb1a47b323
2 changed files with 35 additions and 0 deletions

View File

@ -154,6 +154,25 @@ class IDF_Commit extends Pluf_Model
$commit->origauthor = $change->author; $commit->origauthor = $change->author;
$commit->creation_dtime = $change->date; $commit->creation_dtime = $change->date;
$commit->create(); $commit->create();
// We notify the creation of the commit
if ('' != $project->getConf()->getVal('source_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'c' => $commit,
'project' => $project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/source/commit-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$project->getConf()->getVal('source_notification_email'),
sprintf(__('New Commit %s - %s (%s)'),
$commit->scm_id, $commit->summary, $project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
return $commit; return $commit;
} }

View File

@ -0,0 +1,16 @@
{trans 'Hello,'}
{blocktrans}A new commit has been created:{/blocktrans}
{$c.summary|safe}
{trans 'Commit:'} {$c.scm_id|safe}
{trans 'Project:'} {$project.name|safe}
{trans 'Created by:'} {$c.get_author|safe}
{trans 'Created at:'} {$c.creation_dtime|date:"%Y-%m-%d %H:%M:%S"}
{if $c.fullmessage}
{trans 'Content:'}
{$c.fullmessage}
{/if}
--
{trans 'Commit details:'} {$url_base}{url 'IDF_Views_Source::commit', array($project.shortname, $c.scm_id)}