Remove notification on unshare/unassign and add type hints
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -74,6 +74,8 @@ class AssignmentService {
|
||||
* @var IEventDispatcher
|
||||
*/
|
||||
private $eventDispatcher;
|
||||
/** @var string|null */
|
||||
private $currentUser;
|
||||
|
||||
public function __construct(
|
||||
PermissionService $permissionService,
|
||||
@@ -138,8 +140,7 @@ class AssignmentService {
|
||||
}
|
||||
|
||||
|
||||
if ($userId !== $this->currentUser) {
|
||||
/* Notifyuser about the card assignment */
|
||||
if ($type === Assignment::TYPE_USER && $userId !== $this->currentUser) {
|
||||
$this->notificationHelper->sendCardAssigned($card, $userId);
|
||||
}
|
||||
|
||||
@@ -183,8 +184,12 @@ class AssignmentService {
|
||||
$assignment = $this->assignedUsersMapper->delete($assignment);
|
||||
$card = $this->cardMapper->find($cardId);
|
||||
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_USER_UNASSIGN, ['assigneduser' => $userId]);
|
||||
if ($type === Assignment::TYPE_USER && $userId !== $this->currentUser) {
|
||||
$this->notificationHelper->markCardAssignedAsRead($card, $userId);
|
||||
}
|
||||
$this->changeHelper->cardChanged($cardId);
|
||||
|
||||
|
||||
$this->eventDispatcher->dispatchTyped(new CardUpdatedEvent($card));
|
||||
|
||||
return $assignment;
|
||||
|
||||
@@ -510,11 +510,10 @@ class BoardService {
|
||||
$acl->setPermissionEdit($edit);
|
||||
$acl->setPermissionShare($share);
|
||||
$acl->setPermissionManage($manage);
|
||||
|
||||
$this->notificationHelper->sendBoardShared($boardId, $acl);
|
||||
|
||||
$newAcl = $this->aclMapper->insert($acl);
|
||||
|
||||
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $newAcl, ActivityManager::SUBJECT_BOARD_SHARE);
|
||||
$this->notificationHelper->sendBoardShared((int)$boardId, $acl);
|
||||
$this->boardMapper->mapAcl($newAcl);
|
||||
$this->changeHelper->boardChanged($boardId);
|
||||
|
||||
@@ -599,9 +598,8 @@ class BoardService {
|
||||
}
|
||||
}
|
||||
|
||||
$this->notificationHelper->sendBoardShared($acl->getBoardId(), $acl);
|
||||
|
||||
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $acl, ActivityManager::SUBJECT_BOARD_UNSHARE);
|
||||
$this->notificationHelper->sendBoardShared($acl->getBoardId(), $acl, true);
|
||||
$this->changeHelper->boardChanged($acl->getBoardId());
|
||||
|
||||
$version = \OCP\Util::getVersion()[0];
|
||||
|
||||
@@ -243,6 +243,7 @@ class CardService {
|
||||
$this->cardMapper->update($card);
|
||||
|
||||
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_DELETE);
|
||||
$this->notificationHelper->markDuedateAsRead($card);
|
||||
$this->changeHelper->cardChanged($card->getId(), false);
|
||||
$this->eventDispatcher->dispatchTyped(new CardDeletedEvent($card));
|
||||
|
||||
@@ -322,6 +323,15 @@ class CardService {
|
||||
$card->setOrder($order);
|
||||
$card->setOwner($owner);
|
||||
$card->setDuedate($duedate);
|
||||
$resetDuedateNotification = false;
|
||||
if (
|
||||
$card->getDuedate() === null ||
|
||||
(new \DateTime($card->getDuedate())) != (new \DateTime($changes->getBefore()->getDuedate()))
|
||||
) {
|
||||
$card->setNotified(false);
|
||||
$resetDuedateNotification = true;
|
||||
}
|
||||
|
||||
if ($deletedAt !== null) {
|
||||
$card->setDeletedAt($deletedAt);
|
||||
}
|
||||
@@ -341,6 +351,9 @@ class CardService {
|
||||
|
||||
|
||||
$card = $this->cardMapper->update($card);
|
||||
if ($resetDuedateNotification) {
|
||||
$this->notificationHelper->markDuedateAsRead($card);
|
||||
}
|
||||
$this->changeHelper->cardChanged($card->getId(), true);
|
||||
|
||||
$this->eventDispatcher->dispatchTyped(new CardUpdatedEvent($card));
|
||||
|
||||
Reference in New Issue
Block a user