Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,19 @@ The board list endpoint supports setting an `If-Modified-Since` header to limit
| stackId | Integer | The id of the stack |

#### Response
It will return an object of the new stack containing the new cards as well.

```json
{"title":"l1 (copy)",
"boardId":6,
"deletedAt":0,
"lastModified":0,
"cards":
[{"title":"ME","description":"123","stackId":73,"type":"plain","lastModified":1599028559,"lastEditor":null,"createdAt":1599028559,"labels":[],"assignedUsers":[],"attachments":null,"attachmentCount":0,"owner":{"primaryKey":"root","uid":"root","displayname":"root","type":0},"order":0,"archived":false,"duedate":null,"deletedAt":0,"commentsUnread":0,"id":109,"overdue":0},
{"title":"ka","description":"","stackId":73,"type":"plain","lastModified":1599028559,"lastEditor":null,"createdAt":1599028559,"labels":[],"assignedUsers":[],"attachments":null,"attachmentCount":0,"owner":{"primaryKey":"root","uid":"root","displayname":"root","type":0},"order":1,"archived":false,"duedate":"2020-08-26T22:00:00+00:00","deletedAt":0,"commentsUnread":0,"id":110,"overdue":3}],
"order":999,
"id":73}
```

##### 200 Success

Expand Down
7 changes: 6 additions & 1 deletion lib/Service/StackService.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,19 @@ public function clone($id, $boardId) {
}

$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.');
}

$stack = $this->stackMapper->find($id);
$board = $this->boardMapper->find($boardId);

if ($stack->getBoardId() !== $board->getId()) {
throw new StatusException('Operation not allowed. Stack is not part of this board');
}


$newStack = new Stack();
$newStack->setTitle($stack->getTitle() . ' (' . $this->l10n->t('copy') . ')');
Expand All @@ -418,7 +424,6 @@ public function clone($id, $boardId) {
);

$cards = $this->cardMapper->findAll($id);
$newCardArray = [];
foreach ($cards as $card) {

$newCard = new Card();
Expand Down
4 changes: 2 additions & 2 deletions src/components/board/Stack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
</form>
</transition>
<Actions v-if="!isArchived" :force-menu="true">
<ActionButton v-if="canManage" icon="icon-archive" @click="modalArchivAllCardsShow=true">
<ActionButton v-if="canEdit" icon="icon-archive" @click="modalArchivAllCardsShow=true">
{{ t('deck', 'Archive all cards') }}
</ActionButton>
<ActionButton v-if="canEdit" icon="icon-clone" @click="cloneStack(stack)">
<ActionButton v-if="canManage" icon="icon-clone" @click="cloneStack(stack)">
{{ t('deck', 'Clone list') }}
</ActionButton>
<ActionButton v-if="canManage" icon="icon-delete" @click="deleteStack(stack)">
Expand Down