Merge pull request #816 from nextcloud/bugfix/780/duplicate-delete-call
Fix duplicate call to delete
This commit is contained in:
@@ -307,6 +307,9 @@ class BoardService {
|
|||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);
|
||||||
$board = $this->find($id);
|
$board = $this->find($id);
|
||||||
|
if ($board->getDeletedAt() > 0) {
|
||||||
|
throw new BadRequestException('This board has already been deleted');
|
||||||
|
}
|
||||||
$board->setDeletedAt(time());
|
$board->setDeletedAt(time());
|
||||||
$board = $this->boardMapper->update($board);
|
$board = $this->boardMapper->update($board);
|
||||||
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $board, ActivityManager::SUBJECT_BOARD_DELETE);
|
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $board, ActivityManager::SUBJECT_BOARD_DELETE);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<?php p($l->t('Archive board')); ?>
|
<?php p($l->t('Archive board')); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-if="boardservice.canManage(b)" ng-click="boardDelete(b)">
|
<li ng-if="boardservice.canManage(b)">
|
||||||
<a class="icon-delete" title ="<?php p($l->t('Delete board')); ?>" ng-click="boardDelete(b)">
|
<a class="icon-delete" title ="<?php p($l->t('Delete board')); ?>" ng-click="boardDelete(b)">
|
||||||
<?php p($l->t('Delete board')); ?>
|
<?php p($l->t('Delete board')); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ class BoardServiceTest extends TestCase {
|
|||||||
public function testDelete() {
|
public function testDelete() {
|
||||||
$board = new Board();
|
$board = new Board();
|
||||||
$board->setOwner('admin');
|
$board->setOwner('admin');
|
||||||
|
$board->setDeletedAt(0);
|
||||||
$this->boardMapper->expects($this->once())
|
$this->boardMapper->expects($this->once())
|
||||||
->method('find')
|
->method('find')
|
||||||
->willReturn($board);
|
->willReturn($board);
|
||||||
@@ -213,7 +214,7 @@ class BoardServiceTest extends TestCase {
|
|||||||
'admin' => 'admin',
|
'admin' => 'admin',
|
||||||
]);
|
]);
|
||||||
$boardDeleted = clone $board;
|
$boardDeleted = clone $board;
|
||||||
$board->setDeletedAt(1);
|
$boardDeleted->setDeletedAt(1);
|
||||||
$this->boardMapper->expects($this->once())
|
$this->boardMapper->expects($this->once())
|
||||||
->method('update')
|
->method('update')
|
||||||
->willReturn($boardDeleted);
|
->willReturn($boardDeleted);
|
||||||
|
|||||||
Reference in New Issue
Block a user