Fix issues when creating a card from a talk message

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-02-19 16:06:46 +01:00
parent 4debfbd251
commit e7f9fc59fa
2 changed files with 10 additions and 5 deletions

View File

@@ -78,8 +78,8 @@ class CardController extends Controller {
* @param int $order * @param int $order
* @return \OCP\AppFramework\Db\Entity * @return \OCP\AppFramework\Db\Entity
*/ */
public function create($title, $stackId, $type = 'plain', $order = 999) { public function create($title, $stackId, $type = 'plain', $order = 999, string $description = '') {
return $this->cardService->create($title, $stackId, $type, $order, $this->userId); return $this->cardService->create($title, $stackId, $type, $order, $this->userId, $description);
} }
/** /**

View File

@@ -58,7 +58,7 @@
type="text" type="text"
:placeholder="t('deck', 'Card title')" :placeholder="t('deck', 'Card title')"
:disabled="loading || !selectedStack"> :disabled="loading || !selectedStack">
<textarea v-model="description" :disabled="loading || !selectedStack" /> <textarea v-model="pendingDescription" :disabled="loading || !selectedStack" />
<div class="modal-buttons"> <div class="modal-buttons">
<button @click="close"> <button @click="close">
{{ t('deck', 'Cancel') }} {{ t('deck', 'Cancel') }}
@@ -77,7 +77,7 @@
<EmptyContent v-else-if="created" icon="icon-checkmark"> <EmptyContent v-else-if="created" icon="icon-checkmark">
{{ t('deck', '"{card}" was added to "{board}"', { card: pendingTitle, board: selectedBoard.title }) }} {{ t('deck', '"{card}" was added to "{board}"', { card: pendingTitle, board: selectedBoard.title }) }}
<template #desc> <template #desc>
<button class="primary"> <button class="primary" @click="openNewCard">
{{ t('deck', 'Open card') }} {{ t('deck', 'Open card') }}
</button> </button>
<button @click="close"> <button @click="close">
@@ -132,6 +132,7 @@ export default {
selectedBoard: '', selectedBoard: '',
creating: false, creating: false,
created: false, created: false,
newCard: null,
} }
}, },
computed: { computed: {
@@ -171,17 +172,21 @@ export default {
}, },
async select() { async select() {
this.creating = true this.creating = true
await cardApi.addCard({ const response = await cardApi.addCard({
boardId: this.selectedBoard.id, boardId: this.selectedBoard.id,
stackId: this.selectedStack.id, stackId: this.selectedStack.id,
title: this.pendingTitle, title: this.pendingTitle,
description: this.pendingDescription, description: this.pendingDescription,
}) })
this.newCard = response
this.creating = false this.creating = false
this.created = true this.created = true
// We do not emit here since we want to give feedback to the user that the card was created // We do not emit here since we want to give feedback to the user that the card was created
// this.$root.$emit('select', createdCard) // this.$root.$emit('select', createdCard)
}, },
openNewCard() {
window.location = generateUrl('/apps/deck') + `#/board/${this.selectedBoard.id}/card/${this.newCard.id}`
},
}, },
} }