Skip to content

Commit 366572f

Browse files
authored
Merge pull request #6324 from nextcloud/backport/6309/stable28
[stable28] fix: Load archived card if URL is opened directly
2 parents 1cab673 + e01e106 commit 366572f

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

src/components/board/Board.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ export default {
166166
await this.$store.dispatch('loadBoardById', this.id)
167167
await this.$store.dispatch('loadStacks', this.id)
168168
169+
const routeCardId = parseInt(this.$route.params.cardId)
170+
// If an archived card is requested, and we cannot find it in the current we load the archived stacks instead
171+
if (routeCardId && !this.$store.getters.cardById(routeCardId)) {
172+
await this.$store.dispatch('loadArchivedStacks', this.id)
173+
174+
if (this.$store.getters.cardById(routeCardId)) {
175+
this.$store.commit('toggleShowArchived', true)
176+
}
177+
}
178+
169179
this.session?.close()
170180
this.session = createSession(this.id)
171181
} catch (e) {

src/store/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ export default new Vuex.Store({
181181
}
182182
})
183183
},
184-
toggleShowArchived(state) {
185-
state.showArchived = !state.showArchived
184+
toggleShowArchived(state, newState = undefined) {
185+
state.showArchived = newState !== undefined ? newState : !state.showArchived
186186
},
187187
/*
188188
* Adds or replaces a board in the store.

src/store/stack.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ export default {
9595
}
9696
commit('setCards', cards)
9797
},
98+
async loadArchivedStacks({ commit, getters }, boardId) {
99+
const archivedStacks = await apiClient.loadArchivedStacks(boardId)
100+
const cards = []
101+
for (const i in archivedStacks) {
102+
const stack = archivedStacks[i]
103+
for (const j in stack.cards) {
104+
cards.push(stack.cards[j])
105+
}
106+
delete stack.cards
107+
if (!getters.stackById(stack.id)) {
108+
commit('addStack', stack)
109+
}
110+
}
111+
commit('setCards', cards)
112+
},
98113
createStack({ commit }, stack) {
99114
stack.boardId = this.state.currentBoard.id
100115
apiClient.createStack(stack)

0 commit comments

Comments
 (0)