diff --git a/src/IDF/Commit.php b/src/IDF/Commit.php index 98e1137..6587148 100644 --- a/src/IDF/Commit.php +++ b/src/IDF/Commit.php @@ -154,6 +154,25 @@ class IDF_Commit extends Pluf_Model $commit->origauthor = $change->author; $commit->creation_dtime = $change->date; $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; } diff --git a/src/IDF/templates/idf/source/commit-created-email.txt b/src/IDF/templates/idf/source/commit-created-email.txt new file mode 100644 index 0000000..1734922 --- /dev/null +++ b/src/IDF/templates/idf/source/commit-created-email.txt @@ -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)}