Esempio n. 1
0
 public function sendNotification(Notification $notification, $notifiers = array())
 {
     if (!empty($notifiers)) {
         $notifiers = array_filter($this->notifiers, function ($notifier) use($notifiers) {
             return in_array($notifier->getNotifierKey(), $notifiers);
         });
     } else {
         $notifiers = $this->notifiers;
     }
     foreach ($notifiers as $notifier) {
         $notifier->notify($notification->getUser(), $notification->getView(), $notification->getViewData(), $notification->getSubject());
     }
 }
Esempio n. 2
0
 private function buildEmail(Project $project, Notification $notification, MailEnhancer $mail_enhancer, $email)
 {
     $mail = $this->getMailSender();
     $mail->setFrom(ForgeConfig::get('sys_noreply'));
     $mail->setTo($email);
     if ($project->getTruncatedEmailsUsage()) {
         $presenter = new MailPresenter($notification->getServiceName(), $notification->getGotoLink(), ForgeConfig::get('sys_fullname'));
         $mail->setSubject($this->renderer->renderToString(self::TRUNCATED_SUBJECT_TEMPLATE, $presenter));
         $mail->setBodyHtml($this->renderer->renderToString(self::TRUNCATED_BODY_TEMPLATE, $presenter));
     } else {
         $mail_enhancer->enhanceMail($mail);
         if ($notification->hasHTMLBody()) {
             $mail->setBodyHtml($notification->getHTMLBody());
         }
         if ($notification->hasTextBody()) {
             $mail->setBodyText($notification->getTextBody());
         }
         $mail->setSubject($notification->getSubject());
     }
     return $mail;
 }
 /**
  * @covers Notification::getSubject
  */
 public function testGetSubject()
 {
     $this->notification->setSubject("Conversation");
     $actual = $this->notification->getSubject();
     $this->assertEquals("Conversation", $actual);
 }