зеркало из https://github.com/nextcloud/deck.git
fix: Load archived card if URL is opened directly
Signed-off-by: Julius Knorr <jus@bitgrid.net>
This commit is contained in:
Родитель
0076026fad
Коммит
ca75c14252
|
@ -179,6 +179,16 @@ export default {
|
|||
await this.$store.dispatch('loadBoardById', this.id)
|
||||
await this.$store.dispatch('loadStacks', this.id)
|
||||
|
||||
const routeCardId = parseInt(this.$route.params.cardId)
|
||||
// If an archived card is requested, and we cannot find it in the current we load the archived stacks instead
|
||||
if (routeCardId && !this.$store.getters.cardById(routeCardId)) {
|
||||
await this.$store.dispatch('loadArchivedStacks', this.id)
|
||||
|
||||
if (this.$store.getters.cardById(routeCardId)) {
|
||||
this.$store.commit('toggleShowArchived', true)
|
||||
}
|
||||
}
|
||||
|
||||
this.session?.close()
|
||||
this.session = createSession(this.id)
|
||||
} catch (e) {
|
||||
|
|
|
@ -172,8 +172,8 @@ export default new Vuex.Store({
|
|||
}
|
||||
})
|
||||
},
|
||||
toggleShowArchived(state) {
|
||||
state.showArchived = !state.showArchived
|
||||
toggleShowArchived(state, newState = undefined) {
|
||||
state.showArchived = newState !== undefined ? newState : !state.showArchived
|
||||
},
|
||||
/*
|
||||
* Adds or replaces a board in the store.
|
||||
|
|
|
@ -78,6 +78,21 @@ export default {
|
|||
}
|
||||
commit('setCards', cards)
|
||||
},
|
||||
async loadArchivedStacks({ commit, getters }, boardId) {
|
||||
const archivedStacks = await apiClient.loadArchivedStacks(boardId)
|
||||
const cards = []
|
||||
for (const i in archivedStacks) {
|
||||
const stack = archivedStacks[i]
|
||||
for (const j in stack.cards) {
|
||||
cards.push(stack.cards[j])
|
||||
}
|
||||
delete stack.cards
|
||||
if (!getters.stackById(stack.id)) {
|
||||
commit('addStack', stack)
|
||||
}
|
||||
}
|
||||
commit('setCards', cards)
|
||||
},
|
||||
createStack({ commit }, stack) {
|
||||
stack.boardId = this.state.currentBoard.id
|
||||
apiClient.createStack(stack)
|
||||
|
|
Загрузка…
Ссылка в новой задаче