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

@@ -492,6 +492,19 @@ The board list endpoint supports setting an `If-Modified-Since` header to limit
##### 200 Success ##### 200 Success
### POST /boards/{boardId}/stacks/{stackId}/clone - Clone a stack
#### Request parameters
| Parameter | Type | Description |
| --------- | ------- | ---------------------------------------- |
| boardId | Integer | The id of the board the stack belongs to |
| stackId | Integer | The id of the stack |
#### Response
##### 200 Success
## Cards ## Cards
### GET /boards/{boardId}/stacks/{stackId}/cards/{cardId} - Get card details ### GET /boards/{boardId}/stacks/{stackId}/cards/{cardId} - Get card details

View File

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

View File

@@ -42,14 +42,14 @@
value=""> value="">
</form> </form>
</transition> </transition>
<Actions v-if="canManage && !isArchived" :force-menu="true"> <Actions v-if="!isArchived" :force-menu="true">
<ActionButton icon="icon-archive" @click="modalArchivAllCardsShow=true"> <ActionButton v-if="canManage" icon="icon-archive" @click="modalArchivAllCardsShow=true">
{{ t('deck', 'Archive all cards') }} {{ t('deck', 'Archive all cards') }}
</ActionButton> </ActionButton>
<ActionButton icon="icon-clone" @click="cloneStack(stack)"> <ActionButton v-if="canEdit" icon="icon-clone" @click="cloneStack(stack)">
{{ t('deck', 'Clone list') }} {{ t('deck', 'Clone list') }}
</ActionButton> </ActionButton>
<ActionButton icon="icon-delete" @click="deleteStack(stack)"> <ActionButton v-if="canManage" icon="icon-delete" @click="deleteStack(stack)">
{{ t('deck', 'Delete list') }} {{ t('deck', 'Delete list') }}
</ActionButton> </ActionButton>
</Actions> </Actions>
@@ -218,7 +218,11 @@ export default {
this.modalArchivAllCardsShow = false this.modalArchivAllCardsShow = false
}, },
cloneStack(stack) { cloneStack(stack) {
this.$store.dispatch('cloneStack', stack) try {
this.$store.dispatch('cloneStack', stack)
} catch (e) {
showError('Could not clone stack: ' + e.response.data.message)
}
}, },
startEditing(stack) { startEditing(stack) {
this.copiedStack = Object.assign({}, stack) this.copiedStack = Object.assign({}, stack)