From ee93d64fd03c7aa8571c6b77ff08749a917f41a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 5 Mar 2019 09:29:28 +0100 Subject: [PATCH] Fix codacy warnings and remove unused code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- js/controller/BoardController.js | 4 ++-- lib/Service/LabelService.php | 17 ----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/js/controller/BoardController.js b/js/controller/BoardController.js index 65b4f9e68..41729c8aa 100644 --- a/js/controller/BoardController.js +++ b/js/controller/BoardController.js @@ -346,7 +346,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St BoardService.getCurrent().labels.push(data); $scope.status.createLabel = false; $scope.newLabel = {}; - }).catch(err => { + }).catch((err) => { OC.Notification.showTemporary(err); }); }; @@ -357,7 +357,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St $scope.labelUpdate = function (label) { label.edit = false; - LabelService.update(label).catch(err => { + LabelService.update(label).catch((err) => { label.title = label.renameTitle; OC.Notification.showTemporary(err); }); diff --git a/lib/Service/LabelService.php b/lib/Service/LabelService.php index 5529fa9f2..f596b19a2 100644 --- a/lib/Service/LabelService.php +++ b/lib/Service/LabelService.php @@ -92,7 +92,6 @@ class LabelService { $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); - //$this->checkDuplicateTitle($boardId, $title); $boardLabels = $this->labelMapper->findAll($boardId); if (\is_array($boardLabels)) { foreach($boardLabels as $boardLabel) { @@ -166,7 +165,6 @@ class LabelService { $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); $label = $this->find($id); - //$this->checkDuplicateTitle($label->getBoardId(), $title); $boardLabels = $this->labelMapper->findAll($label->getBoardId()); if (\is_array($boardLabels)) { @@ -191,19 +189,4 @@ class LabelService { return $this->labelMapper->update($label); } - /** - * @param $boardId - * @param $title - * @throws BadRequestException - */ - private function checkDuplicateTitle($boardId, $title) { - $boardLabels = $this->labelMapper->findAll($boardId); - foreach($boardLabels as $boardLabel) { - if ($boardLabel->getTitle() === $title) { - throw new BadRequestException('title must be unique'); - break; - } - } - } - }