diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index d8997817a..dd11ad3e4 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -307,6 +307,9 @@ class BoardService { $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ); $board = $this->find($id); + if ($board->getDeletedAt() > 0) { + throw new BadRequestException('This board has already been deleted'); + } $board->setDeletedAt(time()); $board = $this->boardMapper->update($board); $this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $board, ActivityManager::SUBJECT_BOARD_DELETE); diff --git a/templates/part.navigation.php b/templates/part.navigation.php index 0e38b5305..5456cb1e9 100644 --- a/templates/part.navigation.php +++ b/templates/part.navigation.php @@ -25,10 +25,10 @@ t('Archive board')); ?> -
  • +
  • - t('Delete board')); ?> - + t('Delete board')); ?> +
  • diff --git a/tests/unit/Service/BoardServiceTest.php b/tests/unit/Service/BoardServiceTest.php index 203442b57..b5949bc81 100644 --- a/tests/unit/Service/BoardServiceTest.php +++ b/tests/unit/Service/BoardServiceTest.php @@ -204,6 +204,7 @@ class BoardServiceTest extends TestCase { public function testDelete() { $board = new Board(); $board->setOwner('admin'); + $board->setDeletedAt(0); $this->boardMapper->expects($this->once()) ->method('find') ->willReturn($board); @@ -213,7 +214,7 @@ class BoardServiceTest extends TestCase { 'admin' => 'admin', ]); $boardDeleted = clone $board; - $board->setDeletedAt(1); + $boardDeleted->setDeletedAt(1); $this->boardMapper->expects($this->once()) ->method('update') ->willReturn($boardDeleted);