Added the notification for the commits.
This commit is contained in:
parent
be7cbabe8d
commit
fb1a47b323
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
src/IDF/templates/idf/source/commit-created-email.txt
Normal file
16
src/IDF/templates/idf/source/commit-created-email.txt
Normal 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)}
|
Loading…
Reference in New Issue
Block a user