Fixed issue 114, email sent in language of commenter.

This commit is contained in:
Loic d'Anterroches
2009-10-08 11:23:33 +02:00
parent ec8ff4f76b
commit b6c5e803cb
16 changed files with 312 additions and 192 deletions

View File

@@ -204,26 +204,7 @@ 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();
}
$patch->notify($this->project->getConf());
return $review;
}

View File

@@ -93,6 +93,6 @@ class IDF_Form_ReviewFileComment extends Pluf_Form
}
$this->patch->get_review()->update(); // reindex and put up in
// the list.
return $this->patch;
return $bc;
}
}

View File

@@ -175,21 +175,7 @@ class IDF_Form_Upload extends Pluf_Form
$upload->setAssoc($tag);
}
// Send the notification
if ('' != $this->project->getConf()->getVal('downloads_notification_email', '')) {
$context = new Pluf_Template_Context(
array('file' => $upload,
'urlfile' => $upload->getAbsoluteUrl($this->project),
'project' => $this->project,
'tags' => $upload->get_tags_list(),
));
$tmpl = new Pluf_Template('idf/downloads/download-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'), $this->project->getConf()->getVal('downloads_notification_email'),
sprintf(__('New download - %s (%s)'),
$upload->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
$upload->notify($this->project->getConf());
return $upload;
}
}

View File

@@ -199,25 +199,7 @@ Add your content here. Format your content with:
$rev->submitter = $this->user;
$rev->summary = __('Initial page creation');
$rev->create();
// send the notification
if ('' != $this->project->getConf()->getVal('wiki_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'page' => $page,
'rev' => $rev,
'project' => $this->project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/wiki/wiki-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$this->project->getConf()->getVal('wiki_notification_email'),
sprintf(__('New Documentation Page %s - %s (%s)'),
$page->title, $page->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
$rev->notify($this->project->getConf());
return $page;
}
}

View File

@@ -236,25 +236,7 @@ class IDF_Form_WikiUpdate extends Pluf_Form
$rev->summary = $this->cleaned_data['comment'];
$rev->changes = $changes;
$rev->create();
// send the notification
if ('' != $this->project->getConf()->getVal('wiki_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'page' => $this->page,
'rev' => $rev,
'project' => $this->project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/wiki/wiki-updated-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$this->project->getConf()->getVal('wiki_notification_email'),
sprintf(__('Documentation Page Changed %s - %s (%s)'),
$this->page->title, $this->page->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
$rev->notify($this->project->getConf(), false);
return $this->page;
}
}