@@ -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 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function cardChanged($cardId, $updateCard = true) { |
62 | 62 | $time = time(); |
63 | 63 | $etag = md5($time . microtime()); |
64 | - $this->cache->set(self::TYPE_CARD . '-' .$cardId, $etag); |
|
64 | + $this->cache->set(self::TYPE_CARD . '-' . $cardId, $etag); |
|
65 | 65 | if ($updateCard) { |
66 | 66 | $sql = 'UPDATE `*PREFIX*deck_cards` SET `last_modified` = ?, `last_editor` = ? WHERE `id` = ?'; |
67 | 67 | $this->db->executeUpdate($sql, [time(), $this->userId, $cardId]); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function stackChanged($stackId, $updateBoard = true) { |
79 | 79 | $time = time(); |
80 | 80 | $etag = md5($time . microtime()); |
81 | - $this->cache->set(self::TYPE_CARD . '-' .$stackId, $etag); |
|
81 | + $this->cache->set(self::TYPE_CARD . '-' . $stackId, $etag); |
|
82 | 82 | if ($updateBoard) { |
83 | 83 | $sql = 'UPDATE `*PREFIX*deck_stacks` SET `last_modified` = ? WHERE `id` = ?'; |
84 | 84 | $this->db->executeUpdate($sql, [time(), $stackId]); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | public function getEtag($type, $id) { |
97 | - $entry = $this->cache->get($type . '-' .$id); |
|
97 | + $entry = $this->cache->get($type . '-' . $id); |
|
98 | 98 | if ($entry === 'null') { |
99 | 99 | return ''; |
100 | 100 | } |
@@ -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 |
@@ -23,16 +23,13 @@ |
||
23 | 23 | |
24 | 24 | namespace OCA\Deck\Controller; |
25 | 25 | |
26 | -use OCA\Deck\Service\DefaultBoardService; |
|
27 | 26 | use OCP\AppFramework\Http\DataResponse; |
28 | 27 | use OCP\AppFramework\Http\NotFoundResponse; |
29 | 28 | use OCP\IConfig; |
30 | 29 | use OCP\IGroup; |
31 | 30 | use OCP\IGroupManager; |
32 | 31 | use OCP\IRequest; |
33 | -use OCP\AppFramework\Http\TemplateResponse; |
|
34 | 32 | use OCP\AppFramework\Controller; |
35 | -use OCP\IL10N; |
|
36 | 33 | |
37 | 34 | class ConfigController extends Controller { |
38 | 35 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | public function index() { |
64 | 64 | $params = [ |
65 | 65 | 'user' => $this->userId, |
66 | - 'maxUploadSize' => (int)\OCP\Util::uploadLimit(), |
|
66 | + 'maxUploadSize' => (int) \OCP\Util::uploadLimit(), |
|
67 | 67 | 'canCreate' => $this->permissionService->canCreate() |
68 | 68 | ]; |
69 | 69 |
@@ -189,6 +189,9 @@ discard block |
||
189 | 189 | return $event; |
190 | 190 | } |
191 | 191 | |
192 | + /** |
|
193 | + * @param string $paramName |
|
194 | + */ |
|
192 | 195 | private function parseParamForBoard($paramName, $subjectParams, $params) { |
193 | 196 | if (array_key_exists($paramName, $subjectParams)) { |
194 | 197 | $params[$paramName] = [ |
@@ -200,6 +203,10 @@ discard block |
||
200 | 203 | } |
201 | 204 | return $params; |
202 | 205 | } |
206 | + |
|
207 | + /** |
|
208 | + * @param string $paramName |
|
209 | + */ |
|
203 | 210 | private function parseParamForStack($paramName, $subjectParams, $params) { |
204 | 211 | if (array_key_exists($paramName, $subjectParams)) { |
205 | 212 | $params[$paramName] = [ |
@@ -211,6 +218,9 @@ discard block |
||
211 | 218 | return $params; |
212 | 219 | } |
213 | 220 | |
221 | + /** |
|
222 | + * @param string $paramName |
|
223 | + */ |
|
214 | 224 | private function parseParamForAttachment($paramName, $subjectParams, $params) { |
215 | 225 | if (array_key_exists($paramName, $subjectParams)) { |
216 | 226 | $params[$paramName] = [ |
@@ -285,6 +295,7 @@ discard block |
||
285 | 295 | * |
286 | 296 | * @param $subjectParams |
287 | 297 | * @param $params |
298 | + * @param IEvent $event |
|
288 | 299 | * @return mixed |
289 | 300 | */ |
290 | 301 | private function parseParamForChanges($subjectParams, $params, $event) { |
@@ -312,6 +323,9 @@ discard block |
||
312 | 323 | return $params; |
313 | 324 | } |
314 | 325 | |
326 | + /** |
|
327 | + * @param string $endpoint |
|
328 | + */ |
|
315 | 329 | public function deckUrl($endpoint) { |
316 | 330 | return $this->urlGenerator->linkToRouteAbsolute('deck.page.index') . '#!' . $endpoint; |
317 | 331 | } |
@@ -281,11 +281,11 @@ |
||
281 | 281 | if (array_key_exists('comment', $subjectParams)) { |
282 | 282 | /** @var IComment $comment */ |
283 | 283 | try { |
284 | - $comment = $this->commentsManager->get((int)$subjectParams['comment']); |
|
284 | + $comment = $this->commentsManager->get((int) $subjectParams['comment']); |
|
285 | 285 | $event->setParsedMessage($comment->getMessage()); |
286 | 286 | } catch (NotFoundException $e) { |
287 | 287 | } |
288 | - $params['comment'] =[ |
|
288 | + $params['comment'] = [ |
|
289 | 289 | 'type' => 'highlight', |
290 | 290 | 'id' => $subjectParams['comment'], |
291 | 291 | 'name' => $comment->getMessage() |
@@ -43,7 +43,7 @@ |
||
43 | 43 | private $cardMapper; |
44 | 44 | |
45 | 45 | public function __construct(ActivityManager $activityManager, CardMapper $cardMapper) { |
46 | - $this->activityManager = $activityManager; |
|
46 | + $this->activityManager = $activityManager; |
|
47 | 47 | $this->cardMapper = $cardMapper; |
48 | 48 | } |
49 | 49 |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @param CommentsEvent $event |
51 | 51 | */ |
52 | 52 | public function handle(CommentsEvent $event) { |
53 | - if($event->getComment()->getObjectType() !== 'deckCard') { |
|
53 | + if ($event->getComment()->getObjectType() !== 'deckCard') { |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | 57 | $eventType = $event->getEvent(); |
58 | - if( $eventType === CommentsEvent::EVENT_ADD |
|
58 | + if ($eventType === CommentsEvent::EVENT_ADD |
|
59 | 59 | ) { |
60 | 60 | $this->notificationHandler($event); |
61 | 61 | $this->activityHandler($event); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $applicableEvents = [ |
66 | 66 | CommentsEvent::EVENT_UPDATE |
67 | 67 | ]; |
68 | - if(in_array($eventType, $applicableEvents)) { |
|
68 | + if (in_array($eventType, $applicableEvents)) { |
|
69 | 69 | $this->notificationHandler($event); |
70 | 70 | return; |
71 | 71 | } |
@@ -26,10 +26,8 @@ |
||
26 | 26 | |
27 | 27 | use OCA\Deck\StatusException; |
28 | 28 | use OCP\AppFramework\ApiController; |
29 | -use OCP\AppFramework\Http; |
|
30 | 29 | use OCP\AppFramework\Http\DataResponse; |
31 | 30 | use OCP\IRequest; |
32 | - |
|
33 | 31 | use OCA\Deck\Service\BoardService; |
34 | 32 | use Sabre\HTTP\Util; |
35 | 33 |
@@ -95,6 +95,9 @@ discard block |
||
95 | 95 | $this->cardMapper->markNotified($card); |
96 | 96 | } |
97 | 97 | |
98 | + /** |
|
99 | + * @param \OCA\Deck\Db\Card $card |
|
100 | + */ |
|
98 | 101 | public function markDuedateAsRead($card) { |
99 | 102 | $notification = $this->notificationManager->createNotification(); |
100 | 103 | $notification |
@@ -104,6 +107,9 @@ discard block |
||
104 | 107 | $this->notificationManager->markProcessed($notification); |
105 | 108 | } |
106 | 109 | |
110 | + /** |
|
111 | + * @param \OCA\Deck\Db\Card $card |
|
112 | + */ |
|
107 | 113 | public function sendCardAssigned($card, $userId) { |
108 | 114 | $boardId = $this->cardMapper->findBoardId($card->getId()); |
109 | 115 | $board = $this->getBoard($boardId); |