Merge pull request #2812 from nextcloud/bugfix/noid/create-from-talk

Fix issues when creating a card from a talk message
This commit is contained in:
Julius Härtl
2021-02-20 11:05:48 +01:00
committed by GitHub
2 changed files with 10 additions and 5 deletions

View File

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

View File

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