From 3b92f2760d9344020318cd9b90ca9309f097043a Mon Sep 17 00:00:00 2001 From: Luka Trovic Date: Mon, 4 Sep 2023 19:02:54 +0200 Subject: [PATCH] fix: open card with direct link Signed-off-by: Luka Trovic --- src/components/card/CardSidebar.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/card/CardSidebar.vue b/src/components/card/CardSidebar.vue index 6692e3de8..77fd25be0 100644 --- a/src/components/card/CardSidebar.vue +++ b/src/components/card/CardSidebar.vue @@ -145,19 +145,18 @@ export default { titleEditing: '', hasActivity: capabilities && capabilities.activity, locale: getLocale(), + currentCard: null, } }, computed: { ...mapState({ currentBoard: state => state.currentBoard, + cards: state => state.card.cards, }), - ...mapGetters(['canEdit', 'assignables', 'cardActions', 'stackById']), + ...mapGetters(['canEdit', 'assignables', 'cardActions', 'stackById', 'cardById']), title() { return this.titleEditable ? this.titleEditing : this.currentCard.title }, - currentCard() { - return this.$store.getters.cardById(this.id) - }, subtitle() { return t('deck', 'Modified') + ': ' + this.relativeDate(this.currentCard.lastModified * 1000) + ' βΈ± ' + t('deck', 'Created') + ': ' + this.relativeDate(this.currentCard.createdAt * 1000) }, @@ -182,6 +181,19 @@ export default { }, }, }, + watch: { + cards() { + if (!this.currentCard) { + this.currentCard = this.cardById(this.id) + } + }, + id() { + this.currentCard = this.cardById(this.id) + }, + }, + mounted() { + this.currentCard = this.cardById(this.id) + }, methods: { handleUpdateTitleEditable(value) { this.titleEditable = value