Permalink
Browse files

fixed #217 check self_no_notied setting when set recipients to mail

  • Loading branch information...
1 parent 5f41c85 commit 52846529156b7b09947be61a65b3f75343b3225e @yandod yandod committed Mar 29, 2012
Showing with 27 additions and 0 deletions.
  1. +17 −0 app/controllers/components/mailer.php
  2. +10 −0 app/vendors/action_mailer.php
@@ -30,6 +30,23 @@ function beforeRender() {
$this->setHeader('From', $this->controller->Setting->mail_from);
$this->set('footer',$this->controller->Setting->emails_footer);
}
+
+ public function setRecipients($emails) {
+ if (
+ isset($this->controller->current_user['UserPreference']['pref']['no_self_notified']) &&
+ $this->controller->current_user['UserPreference']['pref']['no_self_notified']
+ ) {
+ $new_emails = array();
+ foreach( $emails as $k => $v ) {
+ if ($this->controller->current_user['mail'] == $v) {
+ continue;
+ }
+ $new_emails[$k] = $v;
+ }
+ $emails = $new_emails;
+ }
+ parent::setRecipients($emails);
+ }
function issue_add($Issue) {
# redmine_headers 'Project' => issue.project.identifier,
# 'Issue-Id' => issue.id,
@@ -310,6 +310,16 @@ function deliver($fct = null, $params = null)
$headers = $this->__generateHeader();
+ if (Configure::read('debug')) {
+ $debug = array(
+ 'subject' => $subject,
+ 'mail_body' => $mail_body,
+ 'headers' => $headers
+ );
+ CakeLog::write(LOG_DEBUG,'Recipients:' . $to);
+ CakeLog::write(LOG_DEBUG,var_export($debug,true));
+ return true;
+ }
if (function_exists("mb_send_mail")) {
return mb_send_mail($to, $subject, $mail_body, $headers);
} else {

0 comments on commit 5284652

Please sign in to comment.