| @@ 222-238 (lines=17) @@ | ||
| 219 | * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException |
|
| 220 | * @throws BadRequestException |
|
| 221 | */ |
|
| 222 | public function delete($id) { |
|
| 223 | ||
| 224 | if ( is_numeric($id) === false ) { |
|
| 225 | throw new BadRequestException('stack id must be a number'); |
|
| 226 | } |
|
| 227 | ||
| 228 | $this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 229 | ||
| 230 | $stack = $this->stackMapper->find($id); |
|
| 231 | $stack->setDeletedAt(time()); |
|
| 232 | $stack = $this->stackMapper->update($stack); |
|
| 233 | ||
| 234 | $this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $stack, ActivityManager::SUBJECT_STACK_DELETE); |
|
| 235 | $this->changeHelper->boardChanged($stack->getBoardId()); |
|
| 236 | $this->enrichStackWithCards($stack); |
|
| 237 | return $stack; |
|
| 238 | } |
|
| 239 | ||
| 240 | /** |
|
| 241 | * @param $id |
|
| @@ 333-346 (lines=14) @@ | ||
| 330 | * @throws \OCA\Deck\NoPermissionException |
|
| 331 | * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException |
|
| 332 | */ |
|
| 333 | public function deleteUndo($id) { |
|
| 334 | ||
| 335 | if (is_numeric($id) === false) { |
|
| 336 | throw new BadRequestException('board id must be a number'); |
|
| 337 | } |
|
| 338 | ||
| 339 | $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ); |
|
| 340 | $board = $this->find($id); |
|
| 341 | $board->setDeletedAt(0); |
|
| 342 | $board = $this->boardMapper->update($board); |
|
| 343 | $this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $board, ActivityManager::SUBJECT_BOARD_RESTORE); |
|
| 344 | $this->changeHelper->boardChanged($board->getId()); |
|
| 345 | return $board; |
|
| 346 | } |
|
| 347 | ||
| 348 | /** |
|
| 349 | * @param $id |
|