Пример #1
0
 /**
  * Get new Unread Emails for email notification
  *
  * @Template("OroEmailBundle:Notification:button.html.twig")
  */
 public function placeholderLastAction()
 {
     $currentOrganization = $this->get('oro_security.security_facade')->getOrganization();
     $maxEmailsDisplay = $this->container->getParameter('oro_email.flash_notification.max_emails_display');
     $emailNotificationManager = $this->get('oro_email.manager.notification');
     return ['clank_event' => WebSocketSendProcessor::getUserTopic($this->getUser(), $currentOrganization), 'emails' => json_encode($emailNotificationManager->getEmails($this->getUser(), $maxEmailsDisplay)), 'count' => $emailNotificationManager->getCountNewEmails($this->getUser())];
 }
 public function testSendNotNewEntity()
 {
     $organization = new Organization();
     $organization->setId(1);
     $user = new User();
     $user->setId(1);
     $this->emailUser->expects($this->exactly(1))->method('getOwner')->willReturn($user);
     $this->emailUser->expects($this->exactly(2))->method('getOrganization')->willReturn($organization);
     $this->topicPublisher->expects($this->once())->method('send')->with(WebSocketSendProcessor::getUserTopic($this->emailUser->getOwner(), $this->emailUser->getOrganization()), json_encode(['hasNewEmail' => false]));
     $this->processor->send([1 => ['entity' => $this->emailUser, 'new' => 0]]);
 }
Пример #3
0
 /**
  * Return unique identificator for clank event. This identification
  * is used in notification widget to show message about new emails
  *
  * @return string
  */
 public function getEmailClankEvent()
 {
     if (!$this->securityFacade->hasLoggedUser()) {
         return '';
     }
     $currentOrganization = $this->securityFacade->getOrganization();
     $currentUser = $this->securityFacade->getLoggedUser();
     return WebSocketSendProcessor::getUserTopic($currentUser, $currentOrganization);
 }