File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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) {
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments