@@ -34,6 +34,5 @@ class AssignedLabels extends RelationalEntity implements JsonSerializable {
|
|||||||
$this->addType('id', 'integer');
|
$this->addType('id', 'integer');
|
||||||
$this->addType('cardId', 'integer');
|
$this->addType('cardId', 'integer');
|
||||||
$this->addType('labelId', 'integer');
|
$this->addType('labelId', 'integer');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,5 +55,4 @@ class AssignedLabelsMapper extends DeckMapper {
|
|||||||
$labels = $this->findEntities($sql, [$cardId]);
|
$labels = $this->findEntities($sql, [$cardId]);
|
||||||
return $labels;
|
return $labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -425,7 +425,6 @@ class StackService {
|
|||||||
|
|
||||||
$cards = $this->cardMapper->findAll($id);
|
$cards = $this->cardMapper->findAll($id);
|
||||||
foreach ($cards as $card) {
|
foreach ($cards as $card) {
|
||||||
|
|
||||||
$newCard = new Card();
|
$newCard = new Card();
|
||||||
$newCard->setTitle($card->getTitle());
|
$newCard->setTitle($card->getTitle());
|
||||||
$newCard->setStackId($newStack->getId());
|
$newCard->setStackId($newStack->getId());
|
||||||
@@ -446,11 +445,9 @@ class StackService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($boardId === $stack->getBoardId()) {
|
if ($boardId === $stack->getBoardId()) {
|
||||||
|
|
||||||
$assignedLabels = $this->assignedLabelsMapper->find($card->getId());
|
$assignedLabels = $this->assignedLabelsMapper->find($card->getId());
|
||||||
$newLabelArray = [];
|
$newLabelArray = [];
|
||||||
foreach ($assignedLabels as $assignedLabel) {
|
foreach ($assignedLabels as $assignedLabel) {
|
||||||
|
|
||||||
$assignment = new AssignedLabels();
|
$assignment = new AssignedLabels();
|
||||||
$assignment->setCardId($newCard->getId());
|
$assignment->setCardId($newCard->getId());
|
||||||
$assignment->setLabelId($assignedLabel->getLabelId());
|
$assignment->setLabelId($assignedLabel->getLabelId());
|
||||||
@@ -472,9 +469,7 @@ class StackService {
|
|||||||
$newUserArray[] = $assignment;
|
$newUserArray[] = $assignment;
|
||||||
}
|
}
|
||||||
$newCard->setAssignedUsers($newUserArray);
|
$newCard->setAssignedUsers($newUserArray);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->enrichStackWithCards($newStack);
|
$this->enrichStackWithCards($newStack);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ use OCA\Deck\Db\Stack;
|
|||||||
use OCA\Deck\Db\StackMapper;
|
use OCA\Deck\Db\StackMapper;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use \Test\TestCase;
|
use \Test\TestCase;
|
||||||
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class StackServiceTest
|
* Class StackServiceTest
|
||||||
@@ -70,6 +71,8 @@ class StackServiceTest extends TestCase {
|
|||||||
private $changeHelper;
|
private $changeHelper;
|
||||||
/** @var EventDispatcherInterface */
|
/** @var EventDispatcherInterface */
|
||||||
private $eventDispatcher;
|
private $eventDispatcher;
|
||||||
|
private $l10n;
|
||||||
|
private $userId;
|
||||||
|
|
||||||
public function setUp(): void {
|
public function setUp(): void {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
@@ -85,6 +88,9 @@ class StackServiceTest extends TestCase {
|
|||||||
$this->activityManager = $this->createMock(ActivityManager::class);
|
$this->activityManager = $this->createMock(ActivityManager::class);
|
||||||
$this->changeHelper = $this->createMock(ChangeHelper::class);
|
$this->changeHelper = $this->createMock(ChangeHelper::class);
|
||||||
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
|
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||||
|
$this->l10n = $this->createMock(IL10N::class);
|
||||||
|
$this->userId = "admin";
|
||||||
|
|
||||||
|
|
||||||
$this->stackService = new StackService(
|
$this->stackService = new StackService(
|
||||||
$this->stackMapper,
|
$this->stackMapper,
|
||||||
@@ -98,7 +104,9 @@ class StackServiceTest extends TestCase {
|
|||||||
$this->attachmentService,
|
$this->attachmentService,
|
||||||
$this->activityManager,
|
$this->activityManager,
|
||||||
$this->eventDispatcher,
|
$this->eventDispatcher,
|
||||||
$this->changeHelper
|
$this->changeHelper,
|
||||||
|
$this->l10n,
|
||||||
|
$this->userId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user