Do not send card assignment notifications to ourselves

Signed-off-by: steav <steav8@gmail.com>
This commit is contained in:
steav
2018-07-25 23:21:29 +02:00
committed by Julius Härtl
parent fdc1f275c5
commit 9595e00ae1

View File

@@ -43,8 +43,9 @@ class CardService {
private $notificationHelper; private $notificationHelper;
private $assignedUsersMapper; private $assignedUsersMapper;
private $attachmentService; private $attachmentService;
private $currentUser;
public function __construct(CardMapper $cardMapper, StackMapper $stackMapper, PermissionService $permissionService, BoardService $boardService, NotificationHelper $notificationHelper, AssignedUsersMapper $assignedUsersMapper, AttachmentService $attachmentService) { public function __construct(CardMapper $cardMapper, StackMapper $stackMapper, PermissionService $permissionService, BoardService $boardService, NotificationHelper $notificationHelper, AssignedUsersMapper $assignedUsersMapper, AttachmentService $attachmentService, $userId) {
$this->cardMapper = $cardMapper; $this->cardMapper = $cardMapper;
$this->stackMapper = $stackMapper; $this->stackMapper = $stackMapper;
$this->permissionService = $permissionService; $this->permissionService = $permissionService;
@@ -52,6 +53,7 @@ class CardService {
$this->notificationHelper = $notificationHelper; $this->notificationHelper = $notificationHelper;
$this->assignedUsersMapper = $assignedUsersMapper; $this->assignedUsersMapper = $assignedUsersMapper;
$this->attachmentService = $attachmentService; $this->attachmentService = $attachmentService;
$this->currentUser = $userId;
} }
public function find($cardId) { public function find($cardId) {
@@ -206,9 +208,11 @@ class CardService {
} }
} }
/* Notify user about the card assignment */ if ($userId !== $this->currentUser) {
$card = $this->cardMapper->find($cardId); /* Notifyuser about the card assignment */
$this->notificationHelper->sendCardAssigned($card, $userId); $card = $this->cardMapper->find($cardId);
$this->notificationHelper->sendCardAssigned($card, $userId);
}
$assignment = new AssignedUsers(); $assignment = new AssignedUsers();
$assignment->setCardId($cardId); $assignment->setCardId($cardId);