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
### 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
### 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 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;
}

View File

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