@@ -48,6 +48,9 @@ |
||
| 48 | 48 | return $entity->getBoardId(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param string $participant |
|
| 53 | + */ |
|
| 51 | 54 | public function findByParticipant($type, $participant) { |
| 52 | 55 | $sql = 'SELECT * from *PREFIX*deck_board_acl WHERE type = ? AND participant = ?'; |
| 53 | 56 | return $this->findEntities($sql, [$type, $participant]); |
@@ -34,7 +34,6 @@ |
||
| 34 | 34 | use OCA\Deck\Db\StackMapper; |
| 35 | 35 | use OCA\Deck\StatusException; |
| 36 | 36 | use OCA\Deck\BadRequestException; |
| 37 | -use OCP\Comments\ICommentsManager; |
|
| 38 | 37 | |
| 39 | 38 | |
| 40 | 39 | class StackService { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | private function enrichStackWithCards($stack, $since = -1) { |
| 78 | 78 | $cards = $this->cardMapper->findAll($stack->getId(), null, null, $since); |
| 79 | 79 | |
| 80 | - if(\count($cards) === 0) { |
|
| 80 | + if (\count($cards) === 0) { |
|
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function delete($id) { |
| 218 | 218 | |
| 219 | - if ( is_numeric($id) === false ) { |
|
| 219 | + if (is_numeric($id) === false) { |
|
| 220 | 220 | throw new BadRequestException('stack id must be a number'); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | protected function registerCommentsEventHandler() { |
| 145 | - $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () { |
|
| 145 | + $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function() { |
|
| 146 | 146 | return $this->getContainer()->query(CommentEventHandler::class); |
| 147 | 147 | }); |
| 148 | 148 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $subject = ''; |
| 134 | 134 | switch ($subjectIdentifier) { |
| 135 | 135 | case self::SUBJECT_BOARD_CREATE: |
| 136 | - $subject = $ownActivity ? $this->l10n->t('You have created a new board {board}'): $this->l10n->t('{user} has created a new board {board}'); |
|
| 136 | + $subject = $ownActivity ? $this->l10n->t('You have created a new board {board}') : $this->l10n->t('{user} has created a new board {board}'); |
|
| 137 | 137 | break; |
| 138 | 138 | case self::SUBJECT_BOARD_DELETE: |
| 139 | 139 | $subject = $ownActivity ? $this->l10n->t('You have deleted the board {board}') : $this->l10n->t('{user} has deleted the board {board}'); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | break; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){ |
|
| 371 | + if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) { |
|
| 372 | 372 | $subjectParams['diff'] = true; |
| 373 | 373 | } |
| 374 | 374 | if ($subject === self::SUBJECT_CARD_UPDATE_STACKID) { |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $event->setApp('deck') |
| 380 | 380 | ->setType('deck') |
| 381 | 381 | ->setAuthor($this->userId) |
| 382 | - ->setObject($objectType, (int)$object->getId(), $object->getTitle()) |
|
| 382 | + ->setObject($objectType, (int) $object->getId(), $object->getTitle()) |
|
| 383 | 383 | ->setSubject($subject, array_merge($subjectParams, $additionalParams)) |
| 384 | 384 | ->setTimestamp(time()); |
| 385 | 385 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | $objectId = $entity->getObjectId(); |
| 441 | 441 | break; |
| 442 | 442 | default: |
| 443 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
| 443 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
| 444 | 444 | } |
| 445 | 445 | return $this->cardMapper->find($objectId); |
| 446 | 446 | } |
@@ -455,11 +455,11 @@ discard block |
||
| 455 | 455 | $objectId = $entity->getBoardId(); |
| 456 | 456 | break; |
| 457 | 457 | default: |
| 458 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
| 458 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
| 459 | 459 | } |
| 460 | 460 | return $this->boardMapper->find($objectId); |
| 461 | 461 | } |
| 462 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
| 462 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | private function findDetailsForStack($stackId) { |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | - * @param $subjectIdentifier |
|
| 127 | + * @param string $subjectIdentifier |
|
| 128 | 128 | * @param array $subjectParams |
| 129 | 129 | * @param bool $ownActivity |
| 130 | 130 | * @return string |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | * @param CommentsEvent $event |
| 44 | 44 | */ |
| 45 | 45 | public function handle(CommentsEvent $event) { |
| 46 | - if($event->getComment()->getObjectType() !== 'deckCard') { |
|
| 46 | + if ($event->getComment()->getObjectType() !== 'deckCard') { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $eventType = $event->getEvent(); |
| 51 | - if( $eventType === CommentsEvent::EVENT_ADD |
|
| 51 | + if ($eventType === CommentsEvent::EVENT_ADD |
|
| 52 | 52 | ) { |
| 53 | 53 | $this->notificationHandler($event); |
| 54 | 54 | $this->activityHandler($event); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | CommentsEvent::EVENT_UPDATE, |
| 61 | 61 | CommentsEvent::EVENT_DELETE, |
| 62 | 62 | ]; |
| 63 | - if(in_array($eventType, $applicableEvents)) { |
|
| 63 | + if (in_array($eventType, $applicableEvents)) { |
|
| 64 | 64 | $this->notificationHandler($event); |
| 65 | 65 | return; |
| 66 | 66 | } |
@@ -91,8 +91,8 @@ |
||
| 91 | 91 | $card->setLabels($this->labelMapper->findAssignedLabelsForCard($cardId)); |
| 92 | 92 | $card->setAttachmentCount($this->attachmentService->count($cardId)); |
| 93 | 93 | $user = $this->userManager->get($this->currentUser); |
| 94 | - $lastRead = $this->commentsManager->getReadMark('deckCard', (string)$card->getId(), $user); |
|
| 95 | - $count = $this->commentsManager->getNumberOfCommentsForObject('deckCard', (string)$card->getId(), $lastRead); |
|
| 94 | + $lastRead = $this->commentsManager->getReadMark('deckCard', (string) $card->getId(), $user); |
|
| 95 | + $count = $this->commentsManager->getNumberOfCommentsForObject('deckCard', (string) $card->getId(), $lastRead); |
|
| 96 | 96 | $card->setCommentsUnread($count); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -147,7 +147,7 @@ |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * @return array |
|
| 150 | + * @return integer |
|
| 151 | 151 | */ |
| 152 | 152 | private function getBoardPrerequisites() { |
| 153 | 153 | $groups = $this->groupManager->getUserGroupIds( |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function findAll($since = -1) { |
| 92 | 92 | $userInfo = $this->getBoardPrerequisites(); |
| 93 | 93 | $userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null, $since); |
| 94 | - $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since); |
|
| 94 | + $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'], null, null, $since); |
|
| 95 | 95 | $complete = array_merge($userBoards, $groupBoards); |
| 96 | 96 | $result = []; |
| 97 | 97 | foreach ($complete as &$item) { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function find($boardId) { |
| 127 | 127 | |
| 128 | - if ( is_numeric($boardId) === false ) { |
|
| 128 | + if (is_numeric($boardId) === false) { |
|
| 129 | 129 | throw new BadRequestException('board id must be a number'); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function isArchived($mapper, $id) { |
| 176 | 176 | |
| 177 | - if (is_numeric($id) === false) { |
|
| 177 | + if (is_numeric($id) === false) { |
|
| 178 | 178 | throw new BadRequestException('id must be a number'); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | throw new BadRequestException('mapper must be provided'); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if (is_numeric($id) === false) { |
|
| 211 | + if (is_numeric($id) === false) { |
|
| 212 | 212 | throw new BadRequestException('id must be a number'); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | * @throws BadRequestException |
| 340 | 340 | */ |
| 341 | 341 | public function deleteForce($id) { |
| 342 | - if (is_numeric($id) === false) { |
|
| 342 | + if (is_numeric($id) === false) { |
|
| 343 | 343 | throw new BadRequestException('id must be a number'); |
| 344 | 344 | } |
| 345 | 345 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | throw new BadRequestException('color must be provided'); |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - if ( is_bool($archived) === false ) { |
|
| 376 | + if (is_bool($archived) === false) { |
|
| 377 | 377 | throw new BadRequestException('archived must be a boolean'); |
| 378 | 378 | } |
| 379 | 379 | |
@@ -23,13 +23,9 @@ |
||
| 23 | 23 | |
| 24 | 24 | namespace OCA\Deck\Db; |
| 25 | 25 | |
| 26 | -use OCP\AppFramework\Db\DoesNotExistException; |
|
| 27 | -use OCP\ICache; |
|
| 28 | 26 | use OCP\ICacheFactory; |
| 29 | 27 | use OCP\IDBConnection; |
| 30 | 28 | use OCP\IRequest; |
| 31 | -use OCP\IUserManager; |
|
| 32 | -use OCP\IGroupManager; |
|
| 33 | 29 | |
| 34 | 30 | class ChangeHelper { |
| 35 | 31 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function cardChanged($cardId, $updateCard = true) { |
| 60 | 60 | $time = time(); |
| 61 | 61 | $etag = md5($time . microtime()); |
| 62 | - $this->cache->set(self::TYPE_CARD . '-' .$cardId, $etag); |
|
| 62 | + $this->cache->set(self::TYPE_CARD . '-' . $cardId, $etag); |
|
| 63 | 63 | if ($updateCard) { |
| 64 | 64 | $sql = 'UPDATE `*PREFIX*deck_cards` SET `last_modified` = ? WHERE `id` = ?'; |
| 65 | 65 | $this->db->executeUpdate($sql, [time(), $cardId]); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function stackChanged($stackId, $updateBoard = true) { |
| 77 | 77 | $time = time(); |
| 78 | 78 | $etag = md5($time . microtime()); |
| 79 | - $this->cache->set(self::TYPE_CARD . '-' .$stackId, $etag); |
|
| 79 | + $this->cache->set(self::TYPE_CARD . '-' . $stackId, $etag); |
|
| 80 | 80 | if ($updateBoard) { |
| 81 | 81 | $sql = 'UPDATE `*PREFIX*deck_stacks` SET `last_modified` = ? WHERE `id` = ?'; |
| 82 | 82 | $this->db->executeUpdate($sql, [time(), $stackId]); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function getEtag($type, $id) { |
| 95 | - $entry = $this->cache->get($type . '-' .$id); |
|
| 95 | + $entry = $this->cache->get($type . '-' . $id); |
|
| 96 | 96 | if ($entry === 'null') { |
| 97 | 97 | return ''; |
| 98 | 98 | } |
@@ -31,76 +31,76 @@ |
||
| 31 | 31 | |
| 32 | 32 | class AttachmentApiController extends ApiController { |
| 33 | 33 | |
| 34 | - private $attachmentService; |
|
| 34 | + private $attachmentService; |
|
| 35 | 35 | |
| 36 | - public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { |
|
| 37 | - parent::__construct($appName, $request); |
|
| 38 | - $this->attachmentService = $attachmentService; |
|
| 39 | - } |
|
| 36 | + public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { |
|
| 37 | + parent::__construct($appName, $request); |
|
| 38 | + $this->attachmentService = $attachmentService; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | + /** |
|
| 42 | 42 | * @NoAdminRequired |
| 43 | 43 | * @CORS |
| 44 | 44 | * @NoCSRFRequired |
| 45 | 45 | * |
| 46 | 46 | */ |
| 47 | - public function getAll() { |
|
| 48 | - $attachment = $this->attachmentService->findAll($this->request->getParam('cardId')); |
|
| 49 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 50 | - } |
|
| 47 | + public function getAll() { |
|
| 48 | + $attachment = $this->attachmentService->findAll($this->request->getParam('cardId')); |
|
| 49 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 52 | + /** |
|
| 53 | 53 | * @NoAdminRequired |
| 54 | 54 | * @CORS |
| 55 | 55 | * @NoCSRFRequired |
| 56 | 56 | * |
| 57 | 57 | */ |
| 58 | - public function display() { |
|
| 59 | - $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
| 58 | + public function display() { |
|
| 59 | + $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
| 60 | 60 | return $attachment; |
| 61 | - } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 63 | + /** |
|
| 64 | 64 | * @NoAdminRequired |
| 65 | 65 | * @CORS |
| 66 | 66 | * @NoCSRFRequired |
| 67 | 67 | * |
| 68 | 68 | */ |
| 69 | - public function create($type, $data) { |
|
| 70 | - $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data); |
|
| 71 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 72 | - } |
|
| 69 | + public function create($type, $data) { |
|
| 70 | + $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data); |
|
| 71 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | + /** |
|
| 75 | 75 | * @NoAdminRequired |
| 76 | 76 | * @CORS |
| 77 | 77 | * @NoCSRFRequired |
| 78 | 78 | * |
| 79 | 79 | */ |
| 80 | - public function update($data) { |
|
| 81 | - $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data); |
|
| 82 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 83 | - } |
|
| 80 | + public function update($data) { |
|
| 81 | + $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data); |
|
| 82 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - /** |
|
| 85 | + /** |
|
| 86 | 86 | * @NoAdminRequired |
| 87 | 87 | * @CORS |
| 88 | 88 | * @NoCSRFRequired |
| 89 | 89 | * |
| 90 | 90 | */ |
| 91 | - public function delete() { |
|
| 92 | - $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
| 93 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 94 | - } |
|
| 91 | + public function delete() { |
|
| 92 | + $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
| 93 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 96 | + /** |
|
| 97 | 97 | * @NoAdminRequired |
| 98 | 98 | * @CORS |
| 99 | 99 | * @NoCSRFRequired |
| 100 | 100 | * |
| 101 | 101 | */ |
| 102 | - public function restore() { |
|
| 103 | - $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
| 104 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 105 | - } |
|
| 102 | + public function restore() { |
|
| 103 | + $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
| 104 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | 107 | \ No newline at end of file |