@@ -183,29 +183,7 @@ const initSpecCmdResolver = () => {
183183 match : SAK . communityLinker ,
184184 action : cmdpath => {
185185 const community = cmdpath [ 0 ]
186- const { mainPath, subPath } = store . curRoute
187-
188- if (
189- R . contains ( mainPath , [ ROUTE . USER , ROUTE . COMMUNITIES ] ) ||
190- R . contains ( subPath , [ ROUTE . POST , ROUTE . JOB , ROUTE . VIDEO , ROUTE . REPO ] )
191- ) {
192- Global . location . href = `/${ community } /posts`
193- return hidePanel ( )
194- }
195-
196- store . setViewing ( {
197- community : { raw : community } ,
198- activeThread : THREAD . POST ,
199- post : { } ,
200- } )
201-
202- store . markRoute ( {
203- mainPath : community ,
204- subPath : thread2Subpath ( THREAD . POST ) ,
205- } )
206-
207- dispatchEvent ( EVENT . COMMUNITY_CHANGE )
208- hidePanel ( )
186+ jumpToCommunity ( community )
209187 } ,
210188 } ,
211189 {
@@ -218,6 +196,7 @@ const initSpecCmdResolver = () => {
218196}
219197
220198const doSpecCmd = ( ) => {
199+ if ( store . searching ) return false
221200 const cmd = store . curCmdChain
222201 if ( ! cmd ) return
223202
@@ -233,16 +212,23 @@ const doSpecCmd = () => {
233212}
234213
235214const doNavigate = ( ) => {
236- const { id } = store . activeSuggestion
215+ if ( store . searching ) return false
216+ // const { id } = store.activeSuggestion
237217 if ( R . startsWith ( 'user-raw' , store . activeSuggestion . raw ) ) {
218+ const { raw } = store . activeSuggestion
219+ const login = raw . split ( 'user-raw-' ) [ 1 ]
238220 hidePanel ( )
221+
239222 return dispatchEvent ( EVENT . PREVIEW_OPEN , {
240223 type : TYPE . PREVIEW_USER_VIEW ,
241- data : { id } ,
224+ data : { login } ,
242225 } )
243226 }
244227
245- debug ( 'doNavigate cmd: ' , store . activeSuggestion )
228+ if ( store . searchThread === 'community' ) {
229+ const { raw : communityRaw } = store . activeSuggestion
230+ jumpToCommunity ( communityRaw )
231+ }
246232}
247233
248234export const handleShortCuts = e => {
@@ -324,6 +310,32 @@ const convert2Sugguestions = (data, searchedTotalCount) => {
324310 store . loadSuggestions ( { prefix : '' , data } )
325311}
326312
313+ const jumpToCommunity = communityRaw => {
314+ const { mainPath, subPath } = store . curRoute
315+
316+ if (
317+ R . contains ( mainPath , [ ROUTE . USER , ROUTE . COMMUNITIES ] ) ||
318+ R . contains ( subPath , [ ROUTE . POST , ROUTE . JOB , ROUTE . VIDEO , ROUTE . REPO ] )
319+ ) {
320+ Global . location . href = `/${ communityRaw } /posts`
321+ return hidePanel ( )
322+ }
323+
324+ store . setViewing ( {
325+ community : { raw : communityRaw } ,
326+ activeThread : THREAD . POST ,
327+ post : { } ,
328+ } )
329+
330+ store . markRoute ( {
331+ mainPath : communityRaw ,
332+ subPath : thread2Subpath ( THREAD . POST ) ,
333+ } )
334+
335+ dispatchEvent ( EVENT . COMMUNITY_CHANGE )
336+ hidePanel ( )
337+ }
338+
327339// ###############################
328340// Data & Error handlers
329341// ###############################
@@ -352,7 +364,8 @@ const DataSolver = [
352364 e => ( {
353365 id : e . id ,
354366 logo : e . logo ,
355- raw : `community-raw-${ e . id } ` ,
367+ // raw: `community-raw-${e.id}`,
368+ raw : `${ e . raw } ` ,
356369 title : e . title ,
357370 desc : `${ e . desc } ` ,
358371 } ) ,
@@ -369,7 +382,7 @@ const DataSolver = [
369382 e => ( {
370383 id : e . id ,
371384 logo : e . avatar ,
372- raw : `user-raw-${ e . id } ` ,
385+ raw : `user-raw-${ e . login } ` ,
373386 title : e . nickname ,
374387 desc : `${ e . bio } ` ,
375388 } ) ,
0 commit comments