Fix php cs issues

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-04-22 19:57:19 +02:00
parent 7ad5daabeb
commit 52febb396c
130 changed files with 1068 additions and 1424 deletions

View File

@@ -48,8 +48,7 @@ use OCP\IL10N;
use OCP\IUser;
class ActivityManager {
const DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED = 'DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED';
public const DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED = 'DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED';
private $manager;
private $userId;
private $permissionService;
@@ -60,49 +59,49 @@ class ActivityManager {
private $stackMapper;
private $l10n;
const DECK_OBJECT_BOARD = 'deck_board';
const DECK_OBJECT_CARD = 'deck_card';
public const DECK_OBJECT_BOARD = 'deck_board';
public const DECK_OBJECT_CARD = 'deck_card';
const SUBJECT_BOARD_CREATE = 'board_create';
const SUBJECT_BOARD_UPDATE = 'board_update';
const SUBJECT_BOARD_UPDATE_TITLE = 'board_update_title';
const SUBJECT_BOARD_UPDATE_ARCHIVED = 'board_update_archived';
const SUBJECT_BOARD_DELETE = 'board_delete';
const SUBJECT_BOARD_RESTORE = 'board_restore';
const SUBJECT_BOARD_SHARE = 'board_share';
const SUBJECT_BOARD_UNSHARE = 'board_unshare';
public const SUBJECT_BOARD_CREATE = 'board_create';
public const SUBJECT_BOARD_UPDATE = 'board_update';
public const SUBJECT_BOARD_UPDATE_TITLE = 'board_update_title';
public const SUBJECT_BOARD_UPDATE_ARCHIVED = 'board_update_archived';
public const SUBJECT_BOARD_DELETE = 'board_delete';
public const SUBJECT_BOARD_RESTORE = 'board_restore';
public const SUBJECT_BOARD_SHARE = 'board_share';
public const SUBJECT_BOARD_UNSHARE = 'board_unshare';
const SUBJECT_STACK_CREATE = 'stack_create';
const SUBJECT_STACK_UPDATE = 'stack_update';
const SUBJECT_STACK_UPDATE_TITLE = 'stack_update_title';
const SUBJECT_STACK_UPDATE_ORDER = 'stack_update_order';
const SUBJECT_STACK_DELETE = 'stack_delete';
public const SUBJECT_STACK_CREATE = 'stack_create';
public const SUBJECT_STACK_UPDATE = 'stack_update';
public const SUBJECT_STACK_UPDATE_TITLE = 'stack_update_title';
public const SUBJECT_STACK_UPDATE_ORDER = 'stack_update_order';
public const SUBJECT_STACK_DELETE = 'stack_delete';
const SUBJECT_CARD_CREATE = 'card_create';
const SUBJECT_CARD_DELETE = 'card_delete';
const SUBJECT_CARD_RESTORE = 'card_restore';
const SUBJECT_CARD_UPDATE = 'card_update';
const SUBJECT_CARD_UPDATE_TITLE = 'card_update_title';
const SUBJECT_CARD_UPDATE_DESCRIPTION = 'card_update_description';
const SUBJECT_CARD_UPDATE_DUEDATE = 'card_update_duedate';
const SUBJECT_CARD_UPDATE_ARCHIVE = 'card_update_archive';
const SUBJECT_CARD_UPDATE_UNARCHIVE = 'card_update_unarchive';
const SUBJECT_CARD_UPDATE_STACKID = 'card_update_stackId';
const SUBJECT_CARD_USER_ASSIGN = 'card_user_assign';
const SUBJECT_CARD_USER_UNASSIGN = 'card_user_unassign';
public const SUBJECT_CARD_CREATE = 'card_create';
public const SUBJECT_CARD_DELETE = 'card_delete';
public const SUBJECT_CARD_RESTORE = 'card_restore';
public const SUBJECT_CARD_UPDATE = 'card_update';
public const SUBJECT_CARD_UPDATE_TITLE = 'card_update_title';
public const SUBJECT_CARD_UPDATE_DESCRIPTION = 'card_update_description';
public const SUBJECT_CARD_UPDATE_DUEDATE = 'card_update_duedate';
public const SUBJECT_CARD_UPDATE_ARCHIVE = 'card_update_archive';
public const SUBJECT_CARD_UPDATE_UNARCHIVE = 'card_update_unarchive';
public const SUBJECT_CARD_UPDATE_STACKID = 'card_update_stackId';
public const SUBJECT_CARD_USER_ASSIGN = 'card_user_assign';
public const SUBJECT_CARD_USER_UNASSIGN = 'card_user_unassign';
const SUBJECT_ATTACHMENT_CREATE = 'attachment_create';
const SUBJECT_ATTACHMENT_UPDATE = 'attachment_update';
const SUBJECT_ATTACHMENT_DELETE = 'attachment_delete';
const SUBJECT_ATTACHMENT_RESTORE = 'attachment_restore';
public const SUBJECT_ATTACHMENT_CREATE = 'attachment_create';
public const SUBJECT_ATTACHMENT_UPDATE = 'attachment_update';
public const SUBJECT_ATTACHMENT_DELETE = 'attachment_delete';
public const SUBJECT_ATTACHMENT_RESTORE = 'attachment_restore';
const SUBJECT_LABEL_CREATE = 'label_create';
const SUBJECT_LABEL_UPDATE = 'label_update';
const SUBJECT_LABEL_DELETE = 'label_delete';
const SUBJECT_LABEL_ASSIGN = 'label_assign';
const SUBJECT_LABEL_UNASSING = 'label_unassign';
public const SUBJECT_LABEL_CREATE = 'label_create';
public const SUBJECT_LABEL_UPDATE = 'label_update';
public const SUBJECT_LABEL_DELETE = 'label_delete';
public const SUBJECT_LABEL_ASSIGN = 'label_assign';
public const SUBJECT_LABEL_UNASSING = 'label_unassign';
const SUBJECT_CARD_COMMENT_CREATE = 'card_comment_create';
public const SUBJECT_CARD_COMMENT_CREATE = 'card_comment_create';
public function __construct(
IManager $manager,
@@ -197,7 +196,7 @@ class ActivityManager {
case self::SUBJECT_CARD_UPDATE_DUEDATE:
if (!isset($subjectParams['after'])) {
$subject = $ownActivity ? $this->l10n->t('You have removed the due date of card {card}') : $this->l10n->t('{user} has removed the due date of card {card}');
} else if (!isset($subjectParams['before']) && isset($subjectParams['after'])) {
} elseif (!isset($subjectParams['before']) && isset($subjectParams['after'])) {
$subject = $ownActivity ? $this->l10n->t('You have set the due date of card {card} to {after}') : $this->l10n->t('{user} has set the due date of card {card} to {after}');
} else {
$subject = $ownActivity ? $this->l10n->t('You have updated the due date of card {card} to {after}') : $this->l10n->t('{user} has updated the due date of card {card} to {after}');
@@ -376,7 +375,7 @@ class ActivityManager {
break;
}
if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){
if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) {
$card = $subjectParams['card'];
if ($card->getLastEditor() === $this->userId) {
return null;
@@ -526,5 +525,4 @@ class ActivityManager {
'board' => $board
];
}
}

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck\Activity;
class ChangeSet implements \JsonSerializable {
private $before;
private $after;
private $diff = false;

View File

@@ -50,12 +50,12 @@ class CommentEventHandler implements ICommentsEventHandler {
* @param CommentsEvent $event
*/
public function handle(CommentsEvent $event) {
if($event->getComment()->getObjectType() !== 'deckCard') {
if ($event->getComment()->getObjectType() !== 'deckCard') {
return;
}
$eventType = $event->getEvent();
if( $eventType === CommentsEvent::EVENT_ADD
if ($eventType === CommentsEvent::EVENT_ADD
) {
$this->notificationHandler($event);
$this->activityHandler($event);
@@ -65,7 +65,7 @@ class CommentEventHandler implements ICommentsEventHandler {
$applicableEvents = [
CommentsEvent::EVENT_UPDATE
];
if(in_array($eventType, $applicableEvents)) {
if (in_array($eventType, $applicableEvents)) {
$this->notificationHandler($event);
return;
}
@@ -79,7 +79,6 @@ class CommentEventHandler implements ICommentsEventHandler {
$comment = $event->getComment();
$card = $this->cardMapper->find($comment->getObjectId());
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_COMMENT_CREATE, ['comment' => $comment]);
}
/**

View File

@@ -25,7 +25,6 @@
namespace OCA\Deck\Activity;
use cogpowered\FineDiff\Diff;
use OCA\Deck\Db\Acl;
use OCP\Activity\IEvent;

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity;
class DescriptionSetting extends Setting {
/**
@@ -41,5 +40,4 @@ class DescriptionSetting extends Setting {
public function getName() {
return $this->l->t('A <strong>card description</strong> inside the Deck app has been changed');
}
}

View File

@@ -27,7 +27,6 @@ use OCP\IL10N;
use OCP\IURLGenerator;
class Filter implements \OCP\Activity\IFilter {
private $l10n;
private $urlGenerator;

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity;
use OCP\IL10N;
class Setting implements \OCP\Activity\ISetting {

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity;
class SettingComment extends Setting {
/**
@@ -49,5 +48,4 @@ class SettingComment extends Setting {
public function canChangeStream() {
return false;
}
}

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\AppInfo;
use Exception;
use InvalidArgumentException;
use OC_Util;
use OCA\Deck\Activity\CommentEventHandler;
use OCA\Deck\Capabilities;
@@ -52,10 +51,8 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\IURLGenerator;
use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App {
public const APP_ID = 'deck';
public const COMMENT_ENTITY_TYPE = 'deckCard';
@@ -69,7 +66,7 @@ class Application extends App {
/** @var IFullTextSearchManager */
private $fullTextSearchManager;
public function __construct(array $urlParams = array()) {
public function __construct(array $urlParams = []) {
parent::__construct('deck', $urlParams);
$container = $this->getContainer();
@@ -81,10 +78,10 @@ class Application extends App {
$container->registerMiddleWare(ExceptionMiddleware::class);
$container->registerMiddleWare(DefaultBoardMiddleware::class);
$container->registerService('databaseType', static function() use ($server) {
$container->registerService('databaseType', static function () use ($server) {
return $server->getConfig()->getSystemValue('dbtype', 'sqlite');
});
$container->registerService('database4ByteSupport', static function() use ($server) {
$container->registerService('database4ByteSupport', static function () use ($server) {
return $server->getDatabaseConnection()->supports4ByteText();
});
}
@@ -100,7 +97,7 @@ class Application extends App {
public function registerNavigationEntry(): void {
$container = $this->getContainer();
$this->server->getNavigationManager()->add(static function() use ($container) {
$this->server->getNavigationManager()->add(static function () use ($container) {
$urlGenerator = $container->query(IURLGenerator::class);
return [
'id' => 'deck',
@@ -117,7 +114,7 @@ class Application extends App {
// Delete user/group acl entries when they get deleted
/** @var IUserManager $userManager */
$userManager = $this->server->getUserManager();
$userManager->listen('\OC\User', 'postDelete', static function(IUser $user) use ($container) {
$userManager->listen('\OC\User', 'postDelete', static function (IUser $user) use ($container) {
// delete existing acl entries for deleted user
/** @var AclMapper $aclMapper */
$aclMapper = $container->query(AclMapper::class);
@@ -135,7 +132,7 @@ class Application extends App {
/** @var IUserManager $userManager */
$groupManager = $this->server->getGroupManager();
$groupManager->listen('\OC\Group', 'postDelete', static function(IGroup $group) use ($container) {
$groupManager->listen('\OC\Group', 'postDelete', static function (IGroup $group) use ($container) {
/** @var AclMapper $aclMapper */
$aclMapper = $container->query(AclMapper::class);
$aclMapper->findByParticipant(Acl::PERMISSION_TYPE_GROUP, $group->getGID());
@@ -152,8 +149,8 @@ class Application extends App {
}
public function registerCommentsEntity(): void {
$this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
$event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function($name) {
$this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
$event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function ($name) {
/** @var CardMapper */
$cardMapper = $this->getContainer()->query(CardMapper::class);
$permissionService = $this->getContainer()->query(PermissionService::class);
@@ -222,35 +219,34 @@ class Application extends App {
/** @var IEventDispatcher $eventDispatcher */
$eventDispatcher = $this->server->query(IEventDispatcher::class);
$eventDispatcher->addListener(
'\OCA\Deck\Card::onCreate', function(Event $e) {
$this->fullTextSearchService->onCardCreated($e);
}
'\OCA\Deck\Card::onCreate', function (Event $e) {
$this->fullTextSearchService->onCardCreated($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Card::onUpdate', function(Event $e) {
$this->fullTextSearchService->onCardUpdated($e);
}
'\OCA\Deck\Card::onUpdate', function (Event $e) {
$this->fullTextSearchService->onCardUpdated($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Card::onDelete', function(Event $e) {
$this->fullTextSearchService->onCardDeleted($e);
}
'\OCA\Deck\Card::onDelete', function (Event $e) {
$this->fullTextSearchService->onCardDeleted($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Board::onShareNew', function(Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
'\OCA\Deck\Board::onShareNew', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Board::onShareEdit', function(Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
'\OCA\Deck\Board::onShareEdit', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Board::onShareDelete', function(Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
'\OCA\Deck\Board::onShareDelete', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
);
}
}

View File

@@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
namespace OCA\Deck;
@@ -31,4 +31,4 @@ class ArchivedItemException extends \Exception {
public function __construct($msg = 'Operation not allowed. Item is archived.') {
parent::__construct($msg);
}
}
}

View File

@@ -24,8 +24,8 @@
namespace OCA\Deck;
use OCP\AppFramework\Http;
class BadRequestException extends StatusException {
class BadRequestException extends StatusException {
public function __construct($message) {
parent::__construct($message);
}
@@ -33,4 +33,4 @@ class BadRequestException extends StatusException {
public function getStatus() {
return HTTP::STATUS_BAD_REQUEST;
}
}
}

View File

@@ -23,10 +23,9 @@
namespace OCA\Deck;
use OCP\Capabilities\ICapability;
class Capabilities implements ICapability {
class Capabilities implements ICapability {
/**
* Function an app uses to return the capabilities

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck\Collaboration\Resources;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Service\PermissionService;
use OCP\AppFramework\Db\DoesNotExistException;
@@ -34,12 +32,10 @@ use OCP\AppFramework\QueryException;
use OCP\Collaboration\Resources\IManager;
use OCP\Collaboration\Resources\IProvider;
use OCP\Collaboration\Resources\IResource;
use OCP\Collaboration\Resources\ResourceException;
use OCP\IUser;
class ResourceProvider implements IProvider {
const RESOURCE_TYPE = 'deck';
public const RESOURCE_TYPE = 'deck';
private $boardMapper;
private $permissionService;
@@ -83,7 +79,6 @@ class ResourceProvider implements IProvider {
'link' => $link,
'iconUrl' => \OC::$server->getURLGenerator()->imagePath('deck', 'deck-dark.svg')
];
}
/**

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Collaboration\Resources;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
@@ -40,8 +39,7 @@ use OCP\IURLGenerator;
use OCP\IUser;
class ResourceProviderCard implements IProvider {
const RESOURCE_TYPE = 'deck-card';
public const RESOURCE_TYPE = 'deck-card';
/** @var CardMapper */
private $cardMapper;
@@ -101,7 +99,6 @@ class ResourceProviderCard implements IProvider {
'link' => $link,
'iconUrl' => $this->urlGenerator->imagePath('core', 'actions/toggle-pictures.svg')
];
}
/**

View File

@@ -38,7 +38,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class UserExport extends Command {
protected $boardService;
protected $cardMapper;
private $userManager;
@@ -85,7 +84,6 @@ class UserExport extends Command {
* @throws \ReflectionException
*/
protected function execute(InputInterface $input, OutputInterface $output) {
$userId = $input->getArgument('user-id');
$this->boardService->setUserId($userId);
@@ -110,5 +108,3 @@ class UserExport extends Command {
$output->writeln(json_encode($data, JSON_PRETTY_PRINT));
}
}

View File

@@ -25,82 +25,80 @@ namespace OCA\Deck\Controller;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\IRequest;
use OCA\Deck\Service\AttachmentService;
class AttachmentApiController extends ApiController {
private $attachmentService;
private $attachmentService;
public function __construct($appName, IRequest $request, AttachmentService $attachmentService) {
parent::__construct($appName, $request);
$this->attachmentService = $attachmentService;
}
public function __construct($appName, IRequest $request, AttachmentService $attachmentService) {
parent::__construct($appName, $request);
$this->attachmentService = $attachmentService;
}
/**
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
public function getAll() {
$attachment = $this->attachmentService->findAll($this->request->getParam('cardId'), true);
return new DataResponse($attachment, HTTP::STATUS_OK);
}
public function getAll() {
$attachment = $this->attachmentService->findAll($this->request->getParam('cardId'), true);
return new DataResponse($attachment, HTTP::STATUS_OK);
}
/**
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
public function display() {
$attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
public function display() {
$attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
return $attachment;
}
}
/**
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
public function create($type, $data) {
$attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data);
return new DataResponse($attachment, HTTP::STATUS_OK);
}
public function create($type, $data) {
$attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data);
return new DataResponse($attachment, HTTP::STATUS_OK);
}
/**
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
public function update($data) {
$attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data);
return new DataResponse($attachment, HTTP::STATUS_OK);
}
public function update($data) {
$attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data);
return new DataResponse($attachment, HTTP::STATUS_OK);
}
/**
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
public function delete() {
$attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
return new DataResponse($attachment, HTTP::STATUS_OK);
}
public function delete() {
$attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
return new DataResponse($attachment, HTTP::STATUS_OK);
}
/**
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
public function restore() {
$attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
return new DataResponse($attachment, HTTP::STATUS_OK);
}
}
public function restore() {
$attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
return new DataResponse($attachment, HTTP::STATUS_OK);
}
}

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Controller;
use OCA\Deck\Service\AttachmentService;
use OCP\AppFramework\Controller;
use OCP\IRequest;
@@ -88,4 +87,4 @@ class AttachmentController extends Controller {
public function restore($cardId, $attachmentId) {
return $this->attachmentService->restore($cardId, $attachmentId);
}
}
}

View File

@@ -39,7 +39,6 @@ use Sabre\HTTP\Util;
* @package OCA\Deck\Controller
*/
class BoardApiController extends ApiController {
private $boardService;
/**
@@ -74,7 +73,7 @@ class BoardApiController extends ApiController {
$boards = $this->boardService->findAll($date->getTimestamp(), $details);
}
return new DataResponse($boards, HTTP::STATUS_OK);
}
}
/**
* @NoAdminRequired
@@ -175,5 +174,4 @@ class BoardApiController extends ApiController {
$acl = $this->boardService->deleteAcl($aclId);
return new DataResponse($acl, HTTP::STATUS_OK);
}
}

View File

@@ -28,9 +28,6 @@ use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\PermissionService;
use OCP\AppFramework\ApiController;
use OCP\IRequest;
use OCP\AppFramework\Controller;
use OCP\IUserManager;
use OCP\IGroupManager;
class BoardController extends ApiController {
private $userId;
@@ -158,5 +155,4 @@ class BoardController extends ApiController {
public function clone($boardId) {
return $this->boardService->clone($boardId);
}
}

View File

@@ -33,10 +33,10 @@
use OCA\Deck\Service\CardService;
/**
* Class BoardApiController
*
* @package OCA\Deck\Controller
*/
* Class BoardApiController
*
* @package OCA\Deck\Controller
*/
class CardApiController extends ApiController {
private $cardService;
private $userId;

View File

@@ -29,7 +29,6 @@ use OCP\IRequest;
use OCP\AppFramework\Controller;
class CardController extends Controller {
private $userId;
private $cardService;
private $assignmentService;
@@ -96,7 +95,7 @@ class CardController extends Controller {
* @return \OCP\AppFramework\Db\Entity
*/
public function update($id, $title, $stackId, $type, $order, $description, $duedate, $deletedAt) {
return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId, $duedate, $deletedAt);
return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId, $duedate, $deletedAt);
}
/**
@@ -166,7 +165,4 @@ class CardController extends Controller {
public function unassignUser($cardId, $userId, $type = 0) {
return $this->assignmentService->unassignUser($cardId, $userId, $type);
}
}

View File

@@ -23,13 +23,10 @@
namespace OCA\Deck\Controller;
use OCA\Deck\BadRequestException;
use OCA\Deck\Service\CommentService;
use OCA\Deck\StatusException;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCSController;
use OCP\IRequest;

View File

@@ -23,19 +23,15 @@
namespace OCA\Deck\Controller;
use OCA\Deck\Service\DefaultBoardService;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Controller;
use OCP\IL10N;
class ConfigController extends Controller {
private $config;
private $userId;
private $groupManager;
@@ -100,7 +96,7 @@ class ConfigController extends Controller {
private function getGroupLimit() {
$groups = $this->getGroupLimitList();
$groups = array_map(function($groupId) {
$groups = array_map(function ($groupId) {
/** @var IGroup $groups */
$group = $this->groupManager->get($groupId);
if ($group === null) {
@@ -113,5 +109,4 @@ class ConfigController extends Controller {
}, $groups);
return array_filter($groups);
}
}

View File

@@ -28,15 +28,13 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
use OCA\Deck\Service\LabelService;
use OCA\Deck\Controller\Helper\ApiHelper;
/**
/**
* Class BoardApiController
*
* @package OCA\Deck\Controller
*/
class LabelApiController extends ApiController {
private $labelService;
private $userId;
@@ -48,8 +46,8 @@ class LabelApiController extends ApiController {
*/
public function __construct($appName, IRequest $request, LabelService $labelService, $userId) {
parent::__construct($appName, $request);
$this->labelService = $labelService;
$this->userId = $userId;
$this->labelService = $labelService;
$this->userId = $userId;
}
/**
@@ -60,7 +58,7 @@ class LabelApiController extends ApiController {
* Get a specific label.
*/
public function get() {
$label = $this->labelService->find($this->request->getParam('labelId'));
$label = $this->labelService->find($this->request->getParam('labelId'));
return new DataResponse($label, HTTP::STATUS_OK);
}
@@ -87,7 +85,7 @@ class LabelApiController extends ApiController {
* @params $color
* Update a specific label
*/
public function update($title, $color) {
public function update($title, $color) {
$label = $this->labelService->update($this->request->getParam('labelId'), $title, $color);
return new DataResponse($label, HTTP::STATUS_OK);
}
@@ -96,12 +94,11 @@ class LabelApiController extends ApiController {
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*
* Delete a specific label
*/
public function delete() {
$label = $this->labelService->delete($this->request->getParam('labelId'));
return new DataResponse($label, HTTP::STATUS_OK);
}
}
}

View File

@@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
namespace OCA\Deck\Controller;
@@ -27,9 +27,7 @@ use OCA\Deck\Service\LabelService;
use OCP\IRequest;
use OCP\AppFramework\Controller;
class LabelController extends Controller {
private $labelService;
public function __construct($appName, IRequest $request, LabelService $labelService) {
@@ -67,5 +65,4 @@ class LabelController extends Controller {
public function delete($labelId) {
return $this->labelService->delete($labelId);
}
}

View File

@@ -32,7 +32,6 @@ use OCP\AppFramework\Controller;
use OCP\IL10N;
class PageController extends Controller {
private $permissionService;
private $userId;
private $l10n;
@@ -67,5 +66,4 @@ class PageController extends Controller {
return new TemplateResponse('deck', 'main');
}
}

View File

@@ -39,7 +39,6 @@ use Sabre\HTTP\Util;
* @package OCA\Deck\Controller
*/
class StackApiController extends ApiController {
private $boardService;
private $stackService;

View File

@@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
namespace OCA\Deck\Controller;
@@ -29,7 +29,6 @@ use OCP\IRequest;
use OCP\AppFramework\Controller;
class StackController extends Controller {
private $userId;
private $stackService;
@@ -45,7 +44,7 @@ class StackController extends Controller {
* @return array
*/
public function index($boardId) {
return $this->stackService->findAll($boardId);
return $this->stackService->findAll($boardId);
}
/**
@@ -54,7 +53,7 @@ class StackController extends Controller {
* @return array
*/
public function archived($boardId) {
return $this->stackService->findAllArchived($boardId);
return $this->stackService->findAllArchived($boardId);
}
/**
@@ -108,5 +107,4 @@ class StackController extends Controller {
public function deleted($boardId) {
return $this->stackService->fetchDeleted($boardId);
}
}

View File

@@ -26,14 +26,7 @@ namespace OCA\Deck\Cron;
use OC\BackgroundJob\Job;
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet;
use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\InvalidAttachmentType;
use OCA\Deck\Service\AttachmentService;
use OCA\Deck\Service\CardService;
class CardDescriptionActivity extends Job {
@@ -70,5 +63,4 @@ class CardDescriptionActivity extends Job {
$this->cardMapper->update($card, false);
}
}
}

View File

@@ -65,7 +65,5 @@ class DeleteCron extends Job {
}
$this->attachmentMapper->delete($attachment);
}
}
}
}

View File

@@ -66,5 +66,4 @@ class ScheduledNotifications extends Job {
}
}
}
}

View File

@@ -24,15 +24,14 @@
namespace OCA\Deck\Db;
class Acl extends RelationalEntity {
public const PERMISSION_READ = 0;
public const PERMISSION_EDIT = 1;
public const PERMISSION_SHARE = 2;
public const PERMISSION_MANAGE = 3;
const PERMISSION_READ = 0;
const PERMISSION_EDIT = 1;
const PERMISSION_SHARE = 2;
const PERMISSION_MANAGE = 3;
const PERMISSION_TYPE_USER = 0;
const PERMISSION_TYPE_GROUP = 1;
const PERMISSION_TYPE_CIRCLE = 7;
public const PERMISSION_TYPE_USER = 0;
public const PERMISSION_TYPE_GROUP = 1;
public const PERMISSION_TYPE_CIRCLE = 7;
protected $participant;
protected $type;
@@ -67,5 +66,4 @@ class Acl extends RelationalEntity {
}
return false;
}
}
}

View File

@@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
namespace OCA\Deck\Db;
@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use OCP\IDBConnection;
class AclMapper extends DeckMapper implements IPermissionMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'deck_board_acl', Acl::class);
}
@@ -52,5 +51,4 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
$sql = 'SELECT * from *PREFIX*deck_board_acl WHERE type = ? AND participant = ?';
return $this->findEntities($sql, [$type, $participant]);
}
}

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use JsonSerializable;
class AssignedUsers extends RelationalEntity implements JsonSerializable {
public $id;
protected $participant;
protected $cardId;
@@ -42,5 +41,4 @@ class AssignedUsers extends RelationalEntity implements JsonSerializable {
$this->addType('type', 'integer');
$this->addResolvable('participant');
}
}

View File

@@ -29,9 +29,7 @@ use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager;
class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
private $cardMapper;
private $userManager;
/**
@@ -96,7 +94,7 @@ class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
public function mapParticipant(AssignedUsers &$assignment) {
$self = $this;
$assignment->resolveRelation('participant', function() use (&$self, &$assignment) {
$assignment->resolveRelation('participant', function () use (&$self, &$assignment) {
return $self->getOrigin($assignment);
});
}
@@ -116,5 +114,4 @@ class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
}
return null;
}
}

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
class Attachment extends RelationalEntity {
protected $cardId;
protected $type;
protected $data;
@@ -43,5 +42,4 @@ class Attachment extends RelationalEntity {
$this->addResolvable('createdBy');
$this->addRelation('extendedData');
}
}
}

View File

@@ -32,9 +32,7 @@ use OCP\IDBConnection;
use OCP\IUserManager;
use PDO;
class AttachmentMapper extends DeckMapper implements IPermissionMapper {
private $cardMapper;
private $userManager;
private $qb;
@@ -67,14 +65,14 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$cursor = $qb->execute();
$row = $cursor->fetch(PDO::FETCH_ASSOC);
if($row === false) {
if ($row === false) {
$cursor->closeCursor();
throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
}
$row2 = $cursor->fetch();
$cursor->closeCursor();
if($row2 !== false ) {
if ($row2 !== false) {
throw new MultipleObjectsReturnedException('Did not expect more than one result when executing' . $query);
}
@@ -82,19 +80,19 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
}
public function findByData($cardId, $data) {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from('deck_attachment')
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));
$cursor = $qb->execute();
$row = $cursor->fetch(PDO::FETCH_ASSOC);
if($row === false) {
$cursor->closeCursor();
throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
}
$cursor->closeCursor();
return $this->mapRowToEntity($row);
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from('deck_attachment')
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));
$cursor = $qb->execute();
$row = $cursor->fetch(PDO::FETCH_ASSOC);
if ($row === false) {
$cursor->closeCursor();
throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
}
$cursor->closeCursor();
return $this->mapRowToEntity($row);
}
/**
@@ -113,7 +111,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$entities = [];
$cursor = $qb->execute();
while($row = $cursor->fetch()){
while ($row = $cursor->fetch()) {
$entities[] = $this->mapRowToEntity($row);
}
$cursor->closeCursor();
@@ -143,7 +141,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$entities = [];
$cursor = $qb->execute();
while($row = $cursor->fetch()){
while ($row = $cursor->fetch()) {
$entities[] = $this->mapRowToEntity($row);
}
$cursor->closeCursor();
@@ -182,4 +180,4 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
}
return $this->cardMapper->findBoardId($attachment->getCardId());
}
}
}

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
class Board extends RelationalEntity {
protected $title;
protected $owner;
protected $color;

View File

@@ -24,14 +24,12 @@
namespace OCA\Deck\Db;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\QueryException;
use OCP\IDBConnection;
use OCP\ILogger;
use OCP\IUserManager;
use OCP\IGroupManager;
class BoardMapper extends DeckMapper implements IPermissionMapper {
private $labelMapper;
private $aclMapper;
private $stackMapper;
@@ -143,7 +141,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
if (!$this->circlesEnabled) {
return [];
}
$circles = array_map(function($circle) {
$circles = array_map(function ($circle) {
return $circle->getUniqueId();
}, \OCA\Circles\Api\v1\Circles::joinedCircles('', true));
if (count($circles) === 0) {
@@ -215,7 +213,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
public function mapAcl(Acl &$acl) {
$userManager = $this->userManager;
$groupManager = $this->groupManager;
$acl->resolveRelation('participant', function($participant) use (&$acl, &$userManager, &$groupManager) {
$acl->resolveRelation('participant', function ($participant) use (&$acl, &$userManager, &$groupManager) {
if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {
$user = $userManager->get($participant);
if ($user !== null) {
@@ -255,7 +253,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
*/
public function mapOwner(Board &$board) {
$userManager = $this->userManager;
$board->resolveRelation('owner', function($owner) use (&$userManager) {
$board->resolveRelation('owner', function ($owner) use (&$userManager) {
$user = $userManager->get($owner);
if ($user !== null) {
return new User($user);
@@ -263,6 +261,4 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
return null;
});
}
}

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use DateTime;
class Card extends RelationalEntity {
protected $title;
protected $description;
protected $descriptionPrev;
@@ -49,10 +48,10 @@ class Card extends RelationalEntity {
private $databaseType = 'sqlite';
const DUEDATE_FUTURE = 0;
const DUEDATE_NEXT = 1;
const DUEDATE_NOW = 2;
const DUEDATE_OVERDUE = 3;
public const DUEDATE_FUTURE = 0;
public const DUEDATE_NEXT = 1;
public const DUEDATE_NOW = 2;
public const DUEDATE_OVERDUE = 3;
public function __construct() {
$this->addType('id', 'integer');
@@ -118,5 +117,4 @@ class Card extends RelationalEntity {
unset($json['descriptionPrev']);
return $json;
}
}

View File

@@ -28,7 +28,6 @@ use OCP\IDBConnection;
use OCP\IUserManager;
use OCP\Notification\IManager;
class CardMapper extends DeckMapper implements IPermissionMapper {
/** @var LabelMapper */
@@ -164,7 +163,6 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
foreach ($cards as $card) {
$this->delete($card);
}
}
public function assignLabel($card, $label) {
@@ -199,7 +197,7 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
public function mapOwner(Card &$card) {
$userManager = $this->userManager;
$card->resolveRelation('owner', function($owner) use (&$userManager) {
$card->resolveRelation('owner', function ($owner) use (&$userManager) {
$user = $userManager->get($owner);
if ($user !== null) {
return new User($user);
@@ -207,6 +205,4 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
return null;
});
}
}

View File

@@ -23,18 +23,13 @@
namespace OCA\Deck\Db;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IDBConnection;
use OCP\IRequest;
use OCP\IUserManager;
use OCP\IGroupManager;
class ChangeHelper {
const TYPE_BOARD = 'boardChanged';
const TYPE_CARD = 'cardChanged';
public const TYPE_BOARD = 'boardChanged';
public const TYPE_CARD = 'cardChanged';
private $db;
@@ -100,5 +95,4 @@ class ChangeHelper {
}
return $entry;
}
}

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Db;
use OCP\Share\IShare;
class Circle extends RelationalObject {

View File

@@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
namespace OCA\Deck\Db;
@@ -48,5 +48,4 @@ abstract class DeckMapper extends Mapper {
protected function execute($sql, array $params = [], $limit = null, $offset = null) {
return parent::execute($sql, $params, $limit, $offset);
}
}
}

View File

@@ -27,7 +27,6 @@ use OCP\IGroup;
use OCP\Share\IShare;
class Group extends RelationalObject {
public function __construct(IGroup $group) {
$primaryKey = IShare::TYPE_GROUP . ':' . $group->getGID();
parent::__construct($primaryKey, $group);

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
interface IPermissionMapper {
/**
@@ -43,6 +42,4 @@ interface IPermissionMapper {
* @return int|null id of Board
*/
public function findBoardId($id);
}
}

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
class Label extends RelationalEntity {
protected $title;
protected $color;
protected $boardId;

View File

@@ -26,9 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity;
use OCP\IDBConnection;
class LabelMapper extends DeckMapper implements IPermissionMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'deck_labels', Label::class);
}
@@ -70,10 +68,10 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
public function getAssignedLabelsForBoard($boardId) {
$labels = $this->findAssignedLabelsForBoard($boardId);
$result = array();
$result = [];
foreach ($labels as $label) {
if (!array_key_exists($label->getCardId(), $result)) {
$result[$label->getCardId()] = array();
$result[$label->getCardId()] = [];
}
$result[$label->getCardId()][] = $label;
}

View File

@@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
namespace OCA\Deck\Db;
@@ -26,8 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity;
class RelationalEntity extends Entity implements \JsonSerializable {
private $_relations = array();
private $_relations = [];
private $_resolvedProperties = [];
/**
@@ -137,5 +136,4 @@ class RelationalEntity extends Entity implements \JsonSerializable {
}
return parent::__call($methodName, $args);
}
}
}

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
class RelationalObject implements \JsonSerializable {
protected $primaryKey;
protected $object;
@@ -58,5 +57,4 @@ class RelationalObject implements \JsonSerializable {
throw new \Exception('jsonSerialize is not implemented on ' . get_class($this));
}
}
}
}

View File

@@ -24,12 +24,11 @@
namespace OCA\Deck\Db;
class Stack extends RelationalEntity {
protected $title;
protected $boardId;
protected $deletedAt = 0;
protected $lastModified = 0;
protected $cards = array();
protected $cards = [];
protected $order;
public function __construct() {

View File

@@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
namespace OCA\Deck\Db;
@@ -26,9 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity;
use OCP\IDBConnection;
class StackMapper extends DeckMapper implements IPermissionMapper {
private $cardMapper;
public function __construct(IDBConnection $db, CardMapper $cardMapper) {
@@ -57,9 +55,9 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
public function findDeleted($boardId, $limit = null, $offset = null) {
$sql = 'SELECT * FROM `*PREFIX*deck_stacks` s
$sql = 'SELECT * FROM `*PREFIX*deck_stacks` s
WHERE `s`.`board_id` = ? AND NOT s.deleted_at = 0';
return $this->findEntities($sql, [$boardId], $limit, $offset);
return $this->findEntities($sql, [$boardId], $limit, $offset);
}

View File

@@ -27,7 +27,6 @@ use OCP\IUser;
use OCP\Share\IShare;
class User extends RelationalObject {
public function __construct(IUser $user) {
$primaryKey = IShare::TYPE_USER . ':' . $user->getUID();
parent::__construct($primaryKey, $user);

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck\Event;
use OCP\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* This is a class to keep compatibility for currently used events in full text search integration
@@ -43,13 +41,11 @@ class FTSEvent extends Event {
$this->arguments = $arguments;
}
public function getArgument($key)
{
public function getArgument($key) {
if ($this->hasArgument($key)) {
return $this->arguments[$key];
}
throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key));
}
}

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Exceptions;
use OCA\Deck\StatusException;
class ConflictException extends StatusException {
private $data;
public function __construct($message, $data = null) {
@@ -41,4 +40,4 @@ class ConflictException extends StatusException {
public function getData() {
return $this->data;
}
}
}

View File

@@ -23,15 +23,12 @@
namespace OCA\Deck;
class InvalidAttachmentType extends \Exception {
/**
* InvalidAttachmentType constructor.
*/
public function __construct($type) {
parent::__construct('No matching IAttachmentService implementation found for type ' . $type);
}
}
}

View File

@@ -59,5 +59,4 @@ class DefaultBoardMiddleware extends Middleware {
$this->logger->logException($e);
}
}
}

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Middleware;
use OCA\Deck\Controller\PageController;
use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException;
use OCP\AppFramework\Db\DoesNotExistException;
@@ -35,7 +34,6 @@ use OCP\ILogger;
use OCP\Util;
use OCP\IConfig;
class ExceptionMiddleware extends Middleware {
/** @var ILogger */
@@ -116,5 +114,4 @@ class ExceptionMiddleware extends Middleware {
throw $exception;
}
}

View File

@@ -34,7 +34,6 @@ use OCP\Migration\IRepairStep;
use OCP\Migration\IOutput;
class UnknownUsers implements IRepairStep {
private $userManager;
private $groupManager;
private $aclMapper;
@@ -76,7 +75,6 @@ class UnknownUsers implements IRepairStep {
$this->aclMapper->delete($acl);
}
}
}
}
}

View File

@@ -323,5 +323,4 @@ class Version1000Date20200306161713 extends SimpleMigrationStep {
}
return $schema;
}
}

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck;
class NoPermissionException extends StatusException {
public function __construct($message, $controller = null, $method = null) {
parent::__construct($message);
if ($controller && $method) {
@@ -36,4 +34,4 @@ class NoPermissionException extends StatusException {
public function getStatus() {
return 403;
}
}
}

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck;
class NotFoundException extends StatusException {
public function __construct($message = '') {
parent::__construct($message);
}
@@ -33,4 +31,4 @@ class NotFoundException extends StatusException {
public function getStatus() {
return 404;
}
}
}

View File

@@ -189,5 +189,4 @@ class NotificationHelper {
->setSubject('board-shared', [$board->getTitle(), $this->currentUser]);
return $notification;
}
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
@@ -28,7 +29,6 @@ declare(strict_types=1);
namespace OCA\Deck\Provider;
use OC\FullTextSearch\Model\IndexDocument;
use OC\FullTextSearch\Model\SearchTemplate;
use OCA\Deck\Service\FullTextSearchService;
@@ -46,16 +46,13 @@ use OCP\FullTextSearch\Model\ISearchTemplate;
use OCP\IL10N;
use OCP\IURLGenerator;
/**
* Class DeckProvider
*
* @package OCA\Deck\Provider
*/
class DeckProvider implements IFullTextSearchProvider {
const DECK_PROVIDER_ID = 'deck';
public const DECK_PROVIDER_ID = 'deck';
/** @var IL10N */
@@ -276,6 +273,4 @@ class DeckProvider implements IFullTextSearchProvider {
$this->runner->setInfo($info, $value);
}
}

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl;
@@ -40,8 +39,6 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\EventDispatcher\IEventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class AssignmentService {
@@ -110,7 +107,6 @@ class AssignmentService {
* @throws DoesNotExistException
*/
public function assignUser($cardId, $userId, int $type = AssignedUsers::TYPE_USER) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException;
@@ -42,7 +41,6 @@ use OCP\ICacheFactory;
use OCP\IL10N;
class AttachmentService {
private $attachmentMapper;
private $cardMapper;
private $permissionService;
@@ -116,7 +114,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function findAll($cardId, $withDeleted = false) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -144,7 +141,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function count($cardId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -167,7 +163,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function create($cardId, $type, $data) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -228,7 +223,6 @@ class AttachmentService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
*/
public function display($cardId, $attachmentId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -261,7 +255,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function update($cardId, $attachmentId, $data) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -312,7 +305,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function delete($cardId, $attachmentId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -343,7 +335,6 @@ class AttachmentService {
}
public function restore($cardId, $attachmentId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet;
use OCA\Deck\Collaboration\Resources\ResourceProvider;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\AssignedUsersMapper;
@@ -48,9 +47,7 @@ use OCA\Deck\BadRequestException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class BoardService {
private $boardMapper;
private $stackMapper;
private $labelMapper;
@@ -154,8 +151,7 @@ class BoardService {
* @throws BadRequestException
*/
public function find($boardId) {
if ( is_numeric($boardId) === false ) {
if (is_numeric($boardId) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -202,8 +198,7 @@ class BoardService {
* @throws BadRequestException
*/
public function isArchived($mapper, $id) {
if (is_numeric($id) === false) {
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -232,12 +227,11 @@ class BoardService {
* @throws BadRequestException
*/
public function isDeleted($mapper, $id) {
if ($mapper === false || $mapper === null) {
throw new BadRequestException('mapper must be provided');
}
if (is_numeric($id) === false) {
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -265,7 +259,6 @@ class BoardService {
* @throws BadRequestException
*/
public function create($title, $userId, $color) {
if ($title === false || $title === null) {
throw new BadRequestException('title must be provided');
}
@@ -334,7 +327,6 @@ class BoardService {
* @throws BadRequestException
*/
public function delete($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -364,7 +356,6 @@ class BoardService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
*/
public function deleteUndo($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -392,7 +383,7 @@ class BoardService {
* @throws BadRequestException
*/
public function deleteForce($id) {
if (is_numeric($id) === false) {
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -419,7 +410,6 @@ class BoardService {
* @throws BadRequestException
*/
public function update($id, $title, $color, $archived) {
if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -432,7 +422,7 @@ class BoardService {
throw new BadRequestException('color must be provided');
}
if ( is_bool($archived) === false ) {
if (is_bool($archived) === false) {
throw new BadRequestException('archived must be a boolean');
}
@@ -479,7 +469,6 @@ class BoardService {
* @throws \OCA\Deck\NoPermissionException
*/
public function addAcl($boardId, $type, $participant, $edit, $share, $manage) {
if (is_numeric($boardId) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -529,7 +518,8 @@ class BoardService {
try {
$resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class);
$resourceProvider->invalidateAccessCache($boardId);
} catch (\Exception $e) {}
} catch (\Exception $e) {
}
}
$this->eventDispatcher->dispatch(
@@ -551,7 +541,6 @@ class BoardService {
* @throws BadRequestException
*/
public function updateAcl($id, $edit, $share, $manage) {
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -596,7 +585,6 @@ class BoardService {
* @throws BadRequestException
*/
public function deleteAcl($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -619,7 +607,8 @@ class BoardService {
try {
$resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class);
$resourceProvider->invalidateAccessCache($acl->getBoardId());
} catch (\Exception $e) {}
} catch (\Exception $e) {
}
}
$delete = $this->aclMapper->delete($acl);
@@ -639,7 +628,6 @@ class BoardService {
* @throws BadRequestException
*/
public function clone($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -683,7 +671,7 @@ class BoardService {
private function enrichWithStacks($board, $since = -1) {
$stacks = $this->stackMapper->findAll($board->getId(), null, null, $since);
if(\count($stacks) === 0) {
if (\count($stacks) === 0) {
return;
}
@@ -693,7 +681,7 @@ class BoardService {
private function enrichWithLabels($board, $since = -1) {
$labels = $this->labelMapper->findAll($board->getId(), null, null, $since);
if(\count($labels) === 0) {
if (\count($labels) === 0) {
return;
}
@@ -702,10 +690,9 @@ class BoardService {
private function enrichWithUsers($board, $since = -1) {
$boardUsers = $this->permissionService->findUsers($board->getId());
if(\count($boardUsers) === 0) {
if (\count($boardUsers) === 0) {
return;
}
$board->setUsers(array_values($boardUsers));
}
}

View File

@@ -28,7 +28,6 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet;
use OCA\Deck\Db\AssignedUsers;
use OCA\Deck\Db\AssignedUsersMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
@@ -39,19 +38,13 @@ use OCA\Deck\Event\FTSEvent;
use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\NotFoundException;
use OCA\Deck\StatusException;
use OCA\Deck\BadRequestException;
use OCP\Activity\IEvent;
use OCP\Comments\ICommentsManager;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUserManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class CardService {
private $cardMapper;
private $stackMapper;
private $boardMapper;
@@ -132,7 +125,6 @@ class CardService {
* @throws BadRequestException
*/
public function find($cardId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -218,7 +210,6 @@ class CardService {
* @throws BadRequestException
*/
public function delete($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -257,7 +248,6 @@ class CardService {
* @throws BadRequestException
*/
public function update($id, $title, $stackId, $type, $order = 0, $description = '', $owner, $duedate = null, $deletedAt = null, $archived = null) {
if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -347,7 +337,6 @@ class CardService {
* @throws BadRequestException
*/
public function rename($id, $title) {
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -387,7 +376,6 @@ class CardService {
* @throws BadRequestException
*/
public function reorder($id, $stackId, $order) {
if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -448,7 +436,6 @@ class CardService {
* @throws BadRequestException
*/
public function archive($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -481,7 +468,6 @@ class CardService {
* @throws BadRequestException
*/
public function unarchive($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -513,7 +499,6 @@ class CardService {
* @throws BadRequestException
*/
public function assignLabel($cardId, $labelId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -550,7 +535,6 @@ class CardService {
* @throws BadRequestException
*/
public function removeLabel($cardId, $labelId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -576,5 +560,4 @@ class CardService {
'\OCA\Deck\Card::onUpdate', new FTSEvent(null, ['id' => $cardId, 'card' => $card])
);
}
}

View File

@@ -23,14 +23,12 @@
namespace OCA\Deck\Service;
use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\NoPermissionException;
use OCA\Deck\NotFoundException;
use OCA\Deck\StatusException;
use OCP\AppFramework\Http\DataResponse;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
@@ -39,7 +37,6 @@ use OCP\Comments\NotFoundException as CommentNotFoundException;
use OCP\ILogger;
use OCP\IUserManager;
use OutOfBoundsException;
use Sabre\DAV\Exception\Forbidden;
use function is_numeric;
class CommentService {
@@ -125,7 +122,6 @@ class CommentService {
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
try {
$comment = $this->commentsManager->get($commentId);
} catch (CommentNotFoundException $e) {
throw new NotFoundException('No comment found.');
}
@@ -147,7 +143,6 @@ class CommentService {
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
try {
$comment = $this->commentsManager->get($commentId);
} catch (CommentNotFoundException $e) {
throw new NotFoundException('No comment found.');
}
@@ -170,7 +165,7 @@ class CommentService {
'actorType' => $comment->getActorType(),
'actorDisplayName' => $actorDisplayName,
'creationDateTime' => $comment->getCreationDateTime()->format(\DateTime::ATOM),
'mentions' => array_map(function($mention) {
'mentions' => array_map(function ($mention) {
try {
$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
} catch (OutOfBoundsException $e) {
@@ -187,5 +182,4 @@ class CommentService {
}, $comment->getMentions()),
];
}
}

View File

@@ -31,7 +31,6 @@ use OCA\Deck\BadRequestException;
use OCP\PreConditionNotMetException;
class DefaultBoardService {
private $boardMapper;
private $boardService;
private $stackService;
@@ -39,7 +38,7 @@ class DefaultBoardService {
private $config;
private $l10n;
public function __construct(
public function __construct(
IL10N $l10n,
BoardMapper $boardMapper,
BoardService $boardService,
@@ -47,14 +46,13 @@ class DefaultBoardService {
CardService $cardService,
IConfig $config
) {
$this->boardService = $boardService;
$this->stackService = $stackService;
$this->cardService = $cardService;
$this->config = $config;
$this->boardMapper = $boardMapper;
$this->l10n = $l10n;
}
}
/**
* Return true if this is the first time a user is acessing their instance with deck enabled
@@ -76,7 +74,7 @@ class DefaultBoardService {
}
return false;
}
}
/**
* @param $title
@@ -90,7 +88,6 @@ class DefaultBoardService {
* @throws BadRequestException
*/
public function createDefaultBoard(string $title, string $userId, string $color) {
if ($title === false || $title === null) {
throw new BadRequestException('title must be provided');
}
@@ -103,9 +100,9 @@ class DefaultBoardService {
throw new BadRequestException('color must be provided');
}
$defaultBoard = $this->boardService->create($title, $userId, $color);
$defaultStacks = [];
$defaultCards = [];
$defaultBoard = $this->boardService->create($title, $userId, $color);
$defaultStacks = [];
$defaultCards = [];
$boardId = $defaultBoard->getId();
@@ -118,5 +115,5 @@ class DefaultBoardService {
$defaultCards[] = $this->cardService->create($this->l10n->t('Example Task 1'), $defaultStacks[2]->getId(), 'text', 0, $userId);
return $defaultBoard;
}
}
}

View File

@@ -23,17 +23,13 @@
namespace OCA\Deck\Service;
use OC\Security\CSP\ContentSecurityPolicyManager;
use OCA\Deck\Db\Attachment;
use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Http\StreamResponse;
use OCP\Files\Cache\IScanner;
use OCP\Files\Folder;
use OCP\Files\IAppData;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
@@ -45,9 +41,7 @@ use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
class FileService implements IAttachmentService {
private $l10n;
private $appData;
private $request;
@@ -122,18 +116,18 @@ class FileService implements IAttachmentService {
* @return array
* @throws StatusException
*/
private function getUploadedFile () {
private function getUploadedFile() {
$file = $this->request->getUploadedFile('file');
$error = null;
$phpFileUploadErrors = [
UPLOAD_ERR_OK => $this->l10n->t('The file was uploaded'),
UPLOAD_ERR_INI_SIZE => $this->l10n->t('The uploaded file exceeds the upload_max_filesize directive in php.ini'),
UPLOAD_ERR_FORM_SIZE => $this->l10n->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'),
UPLOAD_ERR_PARTIAL => $this->l10n->t('The file was only partially uploaded'),
UPLOAD_ERR_NO_FILE => $this->l10n->t('No file was uploaded'),
UPLOAD_ERR_NO_TMP_DIR => $this->l10n->t('Missing a temporary folder'),
UPLOAD_ERR_CANT_WRITE => $this->l10n->t('Could not write file to disk'),
UPLOAD_ERR_EXTENSION => $this->l10n->t('A PHP extension stopped the file upload'),
UPLOAD_ERR_OK => $this->l10n->t('The file was uploaded'),
UPLOAD_ERR_INI_SIZE => $this->l10n->t('The uploaded file exceeds the upload_max_filesize directive in php.ini'),
UPLOAD_ERR_FORM_SIZE => $this->l10n->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'),
UPLOAD_ERR_PARTIAL => $this->l10n->t('The file was only partially uploaded'),
UPLOAD_ERR_NO_FILE => $this->l10n->t('No file was uploaded'),
UPLOAD_ERR_NO_TMP_DIR => $this->l10n->t('Missing a temporary folder'),
UPLOAD_ERR_CANT_WRITE => $this->l10n->t('Could not write file to disk'),
UPLOAD_ERR_EXTENSION => $this->l10n->t('A PHP extension stopped the file upload'),
];
if (empty($file)) {
@@ -271,4 +265,4 @@ class FileService implements IAttachmentService {
public function markAsDeleted(Attachment $attachment) {
$attachment->setDeletedAt(time());
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
@@ -28,7 +29,6 @@ declare(strict_types=1);
namespace OCA\Deck\Service;
use OC\FullTextSearch\Model\DocumentAccess;
use OC\FullTextSearch\Model\IndexDocument;
use OCA\Deck\Db\Board;
@@ -47,7 +47,6 @@ use OCP\FullTextSearch\Model\IDocumentAccess;
use OCP\FullTextSearch\Model\IIndex;
use OCP\FullTextSearch\Model\IIndexDocument;
/**
* Class FullTextSearchService
*
@@ -142,7 +141,7 @@ class FullTextSearchService {
$boardId = (int)$e->getArgument('boardId');
$cards = array_map(
function(Card $item) {
function (Card $item) {
return $item->getId();
},
$this->getCardsFromBoard($boardId)
@@ -266,7 +265,6 @@ class FullTextSearchService {
*/
private function getStacksFromBoard(int $boardId): array {
return $this->stackMapper->findAll($boardId, null, null);
}
@@ -278,7 +276,4 @@ class FullTextSearchService {
private function getBoardsFromUser(string $userId): array {
return $this->boardMapper->findAllByUser($userId, null, null, -1);
}
}

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
use OCA\Deck\Db\Attachment;
use OCP\AppFramework\Http\Response;
@@ -95,5 +94,4 @@ interface IAttachmentService {
* @param Attachment $attachment
*/
public function markAsDeleted(Attachment $attachment);
}
}

View File

@@ -30,7 +30,6 @@ use OCA\Deck\Db\LabelMapper;
use OCA\Deck\StatusException;
use OCA\Deck\BadRequestException;
class LabelService {
/** @var LabelMapper */
@@ -77,7 +76,6 @@ class LabelService {
* @throws BadRequestException
*/
public function create($title, $color, $boardId) {
if ($title === false || $title === null) {
throw new BadRequestException('title must be provided');
}
@@ -94,7 +92,7 @@ class LabelService {
$boardLabels = $this->labelMapper->findAll($boardId);
if (\is_array($boardLabels)) {
foreach($boardLabels as $boardLabel) {
foreach ($boardLabels as $boardLabel) {
if ($boardLabel->getTitle() === $title) {
throw new BadRequestException('title must be unique');
break;
@@ -123,7 +121,6 @@ class LabelService {
* @throws BadRequestException
*/
public function delete($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('label id must be a number');
}
@@ -149,7 +146,6 @@ class LabelService {
* @throws BadRequestException
*/
public function update($id, $title, $color) {
if (is_numeric($id) === false) {
throw new BadRequestException('label id must be a number');
}
@@ -168,7 +164,7 @@ class LabelService {
$boardLabels = $this->labelMapper->findAll($label->getBoardId());
if (\is_array($boardLabels)) {
foreach($boardLabels as $boardLabel) {
foreach ($boardLabels as $boardLabel) {
if ($boardLabel->getId() === $label->getId()) {
continue;
}
@@ -188,5 +184,4 @@ class LabelService {
$this->changeHelper->boardChanged($label->getBoardId());
return $this->labelMapper->update($label);
}
}

View File

@@ -33,14 +33,12 @@ use OCA\Deck\NoPermissionException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\AppFramework\QueryException;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUserManager;
use OCP\Share\IManager;
class PermissionService {
/** @var BoardMapper */

View File

@@ -39,9 +39,7 @@ use OCA\Deck\StatusException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class StackService {
private $stackMapper;
private $cardMapper;
private $boardMapper;
@@ -166,7 +164,6 @@ class StackService {
* @throws BadRequestException
*/
public function findAllArchived($boardId) {
if (is_numeric($boardId) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -200,7 +197,6 @@ class StackService {
* @throws BadRequestException
*/
public function create($title, $boardId, $order) {
if ($title === false || $title === null) {
throw new BadRequestException('title must be provided');
}
@@ -245,7 +241,6 @@ class StackService {
* @throws BadRequestException
*/
public function delete($id) {
if (is_numeric($id) === false) {
throw new BadRequestException('stack id must be a number');
}
@@ -284,7 +279,6 @@ class StackService {
* @throws BadRequestException
*/
public function update($id, $title, $boardId, $order, $deletedAt) {
if (is_numeric($id) === false) {
throw new BadRequestException('stack id must be a number');
}
@@ -336,7 +330,6 @@ class StackService {
* @throws BadRequestException
*/
public function reorder($id, $order) {
if (is_numeric($id) === false) {
throw new BadRquestException('id must be a number');
}

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck;
class StatusException extends \Exception {
public function __construct($message) {
parent::__construct($message);
}
@@ -33,4 +31,4 @@ class StatusException extends \Exception {
public function getStatus() {
return 500;
}
}
}