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 $assignedUsersMapper;
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->stackMapper = $stackMapper;
$this->permissionService = $permissionService;
@@ -52,6 +53,7 @@ class CardService {
$this->notificationHelper = $notificationHelper;
$this->assignedUsersMapper = $assignedUsersMapper;
$this->attachmentService = $attachmentService;
$this->currentUser = $userId;
}
public function find($cardId) {
@@ -206,9 +208,11 @@ class CardService {
}
}
/* Notify user about the card assignment */
$card = $this->cardMapper->find($cardId);
$this->notificationHelper->sendCardAssigned($card, $userId);
if ($userId !== $this->currentUser) {
/* Notifyuser about the card assignment */
$card = $this->cardMapper->find($cardId);
$this->notificationHelper->sendCardAssigned($card, $userId);
}
$assignment = new AssignedUsers();
$assignment->setCardId($cardId);