some small changes

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
Jakob Röhrl
2020-08-14 10:09:14 +02:00
parent c39fd43b6c
commit 71780b5578
3 changed files with 28 additions and 15 deletions

View File

@@ -44,7 +44,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\IL10N;
use OCA\Deck\Event\FTSEvent;
use OCA\Deck\Service\AssignmentService;
class StackService {
private $stackMapper;
@@ -63,7 +62,7 @@ class StackService {
private $eventDispatcher;
private $changeHelper;
private $l10n;
private $assignmentService;
private $userId;
public function __construct(
StackMapper $stackMapper,
@@ -80,7 +79,7 @@ class StackService {
EventDispatcherInterface $eventDispatcher,
ChangeHelper $changeHelper,
IL10N $l10n,
AssignmentService $assignmentService
$userId
) {
$this->stackMapper = $stackMapper;
$this->boardMapper = $boardMapper;
@@ -96,7 +95,7 @@ class StackService {
$this->eventDispatcher = $eventDispatcher;
$this->changeHelper = $changeHelper;
$this->l10n = $l10n;
$this->assignmentService = $assignmentService;
$this->userId = $userId;
}
private function enrichStackWithCards($stack, $since = -1) {
@@ -381,12 +380,11 @@ class StackService {
/**
* @param $id
* @param $boardId
* @param $userId
* @return Stack
* @throws StatusException
* @throws BadRequestException
*/
public function clone($id, $boardId, $userId) {
public function clone($id, $boardId) {
if (is_numeric($id) === false) {
throw new BadRequestException('stack id must be a number');
}
@@ -395,7 +393,6 @@ class StackService {
}
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
if ($this->boardService->isArchived(null, $boardId)) {
throw new StatusException('Operation not allowed. This board is archived.');
}
@@ -429,7 +426,7 @@ class StackService {
$newCard->setStackId($newStack->getId());
$newCard->setType($card->getType());
$newCard->setOrder($card->getOrder());
$newCard->setOwner($userId);
$newCard->setOwner($this->userId);
$newCard->setDescription($card->getDescription());
$newCard->setDuedate($card->getDuedate());
@@ -439,7 +436,7 @@ class StackService {
$this->changeHelper->cardChanged($newCard->getId(), false);
$this->eventDispatcher->dispatch('\OCA\Deck\Card::onCreate',
new FTSEvent(
null, ['id' => $newCard->getId(), 'card' => $newCard, 'userId' => $owner, 'stackId' => $stackId]
null, ['id' => $newCard->getId(), 'card' => $newCard, 'userId' => $this->userId, 'stackId' => $stackId]
)
);
@@ -470,7 +467,6 @@ class StackService {
$newUserArray[] = $assignment;
}
$newCard->setAssignedUsers($newUserArray);
$newCardArray[] = $newCard;
}